{"id":15045316,"url":"https://github.com/jenkinsci/http-request-plugin","last_synced_at":"2025-05-16T04:03:39.853Z","repository":{"id":5387527,"uuid":"6575811","full_name":"jenkinsci/http-request-plugin","owner":"jenkinsci","description":"This plugin does a request to an url with some parameters.","archived":false,"fork":false,"pushed_at":"2025-05-01T12:46:44.000Z","size":748,"stargazers_count":164,"open_issues_count":10,"forks_count":158,"subscribers_count":107,"default_branch":"master","last_synced_at":"2025-05-01T13:48:51.097Z","etag":null,"topics":["adopt-this-plugin","http","java","jenkins","plugin"],"latest_commit_sha":null,"homepage":"https://plugins.jenkins.io/http_request","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"go-redis/redis","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2012-11-07T08:03:37.000Z","updated_at":"2025-05-01T12:46:40.000Z","dependencies_parsed_at":"2023-10-01T21:46:02.326Z","dependency_job_id":"29efecab-f9d8-4903-b173-98427e33f1e6","html_url":"https://github.com/jenkinsci/http-request-plugin","commit_stats":{"total_commits":487,"total_committers":70,"mean_commits":6.957142857142857,"dds":0.8275154004106776,"last_synced_commit":"19ec940e97dff1a2eadccc329359c9cffe98a385"},"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fhttp-request-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fhttp-request-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fhttp-request-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fhttp-request-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/http-request-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254464891,"owners_count":22075570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adopt-this-plugin","http","java","jenkins","plugin"],"created_at":"2024-09-24T20:51:43.490Z","updated_at":"2025-05-16T04:03:39.812Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","readme":"[[http-request-plugin]]\n= Http Request Plugin\n:toc: macro\n:toc-title: HTTP Request Plugin ToC\nifdef::env-github[]\n:tip-caption: :bulb:\n:note-caption: :information_source:\n:important-caption: :heavy_exclamation_mark:\n:caution-caption: :fire:\n:warning-caption: :warning:\nendif::[]\n\nlink:https://ci.jenkins.io/job/Plugins/job/http-request-plugin/job/master/[image:https://ci.jenkins.io/job/Plugins/job/http-request-plugin/job/master/badge/icon[Build]]\nlink:https://github.com/jenkinsci/http-request-plugin/graphs/contributors[image:https://img.shields.io/github/contributors/jenkinsci/http-request-plugin.svg?color=blue[Contributors]]\nlink:https://plugins.jenkins.io/http_request/[image:https://img.shields.io/jenkins/plugin/i/http_request.svg?color=blue\u0026label=installations[Jenkins Plugin Installs]]\nlink:https://plugins.jenkins.io/http_request/[image:https://img.shields.io/jenkins/plugin/v/http_request.svg[Plugin]]\nlink:https://github.com/jenkinsci/http-request-plugin/releases/latest[image:https://img.shields.io/github/release/jenkinsci/http-request-plugin.svg?label=changelog[GitHub release]]\n\ntoc::[]\n\n[abstract]\n.Overview\nThis plugin sends a HTTP/HTTPS request to a user specified URL. The request is made via job \nexecution in Jenkins and depending on the HTTP response the job can be marked as failed \n(configurable). For example, responses such as 404 and 500 can make the job fail. When a\njob fails it will log the response to help identify the problem.\n\nAccording to the setting of HTTP mode the request will be performed either using HTTP GET or POST.\nIf there is no such setting then it will use the default from global settings. Default there is POST.\n\n== Features\n\nThe following powerful features are available in both Pipeline and traditional project types, giving you greater control and flexibility over your builds:\n\n* Programmable HTTP method:\nChoose from a variety of HTTP methods, including GET, POST, MKCOL, PUT, PATCH, DELETE, OPTIONS, or HEAD, to suit your project's specific needs.\n\n* Programmable range of expected response codes:\nSpecify a range of expected response codes for your build, and if the response code falls outside the specified range, the build will fail, saving you time and hassle.\n\n* Supports Basic Authentication:\nUse Basic Authentication to ensure that only authorized users can access your project's resources, providing an additional layer of security.\n\n* Supports Form Authentication:\nForm Authentication enables users to authenticate themselves by submitting a username and password through a form, ensuring that only authorized users can access your resources.\n\n* Supports Certificate-based Authentication:\nUse a certificate from a Jenkins stored credential to authenticate your HTTPS requests to a remote server.\n\n* Specify a required string in the response:\nEnsure that a specific string is present in the response by specifying it beforehand. If the string is not present, the build will fail, alerting you to the issue.\n\n* Set a connection timeout limit:\nPrevent builds from taking too long by setting a connection timeout limit. If the limit is exceeded, the build will fail, saving you time and resources.\n\n* Set an \"Accept\" header directly:\nSet the \"Accept\" header directly, providing greater control over the type of data that the server returns in response to a request.\n\n* Set a \"Content-Type\" header directly:\nSet the \"Content-Type\" header directly, specifying the type of data that you are sending in your request, helping to ensure that the server can correctly process your request.\n\n* Set any custom header:\nSet any custom header that you require, enabling you to interact with APIs or web services that require specific headers or authentication protocols.\n\n=== Basic plugin features\n\n[NOTE]\n.Feature Availability\n====\nThe following features are only present in the non-pipeline version of the plugin. For the Pipeline \nversion, these features are available programmatically.\n====\n\n* You can send the build parameters as URL query strings\n* You can store the response to a file, built-in to the plugin\n\n=== Pipeline features\n\nIn a Pipeline job, you have total control over how the url is formed. Suppose you have a build \nparameter called \"`param1`\", you can pass it to the HTTP request programmatically like so:\n\n[source,groovy]\n----\nhttpRequest \"http://httpbin.org/response-headers?param1=${param1}\"\n----\n\nIf you wish to save the response to a file, you need to grab a workspace. You can do this with a \n`node` Pipeline step. For example:\n\n[source,groovy]\n----\ndef response = httpRequest \"http://httpbin.org/response-headers?param1=${param1}\"\nnode() {\n    writeFile file: 'response.txt', text: response.content\n}\n----\n\nYou can access the response status code, content and headers programmatically:\n\n[source,groovy]\n----\ndef response = httpRequest \"http://httpbin.org/response-headers?param1=${param1}\"\nprintln(\"Status: ${response.status}\")\nprintln(\"Response: ${response.content}\")\nprintln(\"Headers: ${response.headers}\")\n----\n\nYou may also send content in the body of the request, such as for a PATCH request:\n\n[source,groovy]\n----\n// create payload\ndef patchOrg = \"\"\"\n    {\"description\": \"$description\"}\n\"\"\"\ndef response = httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON',\n                           httpMode: 'PATCH', requestBody: patchOrg,\n                           url: \"https://api.github.com/orgs/${orgName}\"\n----\n\nYou may also send content in the body of the request, such as for a POST request:\n\n[source,groovy]\n----\nhttpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON',\n            httpMode: 'POST', quiet: true,\n            requestBody: '''{\n               \"display-name\" : \"my_Username\",\n               \"email\" : \"user@example.test\",\n               \"password\" : {\n                  \"value\" : \"my_password\"\n               },\n            }''',\n            url: 'https://api.github.com/orgs/${orgName}'\n----\n\n\nYou can also set custom headers:\n\n[source,groovy]\n----\ndef response = httpRequest customHeaders: [[name: 'foo', value: 'bar']]\n----\n\nYou can also set custom headers with mask set true:\n\n[source,groovy]\n----\ndef response =  httpRequest customHeaders: [[maskValue: true, name: 'foo', value: 'bar']],\n                            url: 'https://api.github.com/orgs/${orgName}'\n----\n\nYou can send ``multipart/form-data`` forms:\n\n[source,groovy]\n----\ndef response = httpRequest httpMode: 'POST', formData: [\n               [contentType: 'application/json', name: 'model', body: '{\"foo\": \"bar\"}'],\n               [contentType: 'text/plain', name: 'file', fileName: 'readme.txt',\n               uploadFile: 'data/lipsum.txt']]\n----\n\nYou can send a request with form-data:\n\n[source,groovy]\n----\ndef response = httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_FORM_DATA',\n                           formData: [[body: '''{\n                                         \"name\" : \"example\",\n                                         \"type\" : \"bot\"\n                                        }''',\n                           contentType: 'text/plain', fileName: 'sample', name: 'data',\n                           uploadFile: './files/readme.txt']],\n                           httpMode: 'POST', quiet: true, responseHandle: 'NONE', timeout: null,\n                           url: 'https://api.github.com/orgs/${orgName}',\n                           validResponseCodes: '200,404', validResponseContent: 'token'\n----\n\nYou can send ``multipart file`` and ``multipart entity name``:\n\n[source,groovy]\n----\ndef response = httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_OCTETSTREAM',\n                           httpMode: 'POST', multipartName: 'file', quiet: true,\n                           responseHandle: 'NONE', timeout: null, uploadFile: './files/readme.txt',\n                           url: 'https://api.github.com/orgs/${orgName}'\n----\n\nYou can send a request with SSL error ignored\n\n[source,groovy]\n----\ndef response = httpRequest ignoreSslErrors: true, responseHandle: 'NONE',\n                           url: 'https://api.github.com/orgs/${orgName}'\n----\n\nYou can send a request with http proxy\n\n[source,groovy]\n----\ndef response = httpRequest httpProxy: 'http://proxy.local', responseHandle: 'NONE',\n                           url: 'https://api.github.com/orgs/${orgName}'\n----\n\nYou can send a request with http proxy authenticate\n\n[source,groovy]\n----\ndef response = httpRequest proxyAuthentication: Basic, 'http://proxy.local',\n               responseHandle: 'NONE', url: 'https://api.github.com/orgs/${orgName}'\n----\n\nYou can send a request with accepted response codes\n\n[source,groovy]\n----\ndef response = httpRequest responseHandle: 'NONE', validResponseCodes: '200,404',\n                           url: 'https://api.github.com/orgs/${orgName}'\n----\n\nYou can send a request with accepted response content\n\n[source,groovy]\n----\ndef response = httpRequest responseHandle: 'STRING',\n                           url: 'https://api.github.com/orgs/${orgName}',\n                           validResponseCodes: '200,404', validResponseContent: 'token'\n----\n\nYou can send a request with connection timeout\n\n[source,groovy]\n----\ndef response = httpRequest timeout: 30, url: 'https://api.github.com/orgs/${orgName}'\n----\n\nYou can send a request where output is written to file\n\n[source,groovy]\n----\ndef response = httpRequest outputFile: 'readme.txt', url:'https://api.github.com/orgs/${orgName}'\n----\n\nYou can send a request where response is printed on the console\n\n[source,groovy]\n----\ndef response = httpRequest consoleLogResponseBody: true,\n               url:'https://api.github.com/orgs/${orgName}'\n----\n\nYou can send a request without logging output — with logs turned off\n\n[source,groovy]\n----\ndef response = httpRequest quiet: true, url:'https://api.github.com/orgs/${orgName}'\n----\n\nYou can handle response\n\n[source,groovy]\n----\ndef response = httpRequest responseHandle: 'LEAVE_OPEN',\n                           url: \"https://api.github.com/orgs/${orgName}\"\nresponse.close() // must call response.close() after a LEAVE_OPEN\n----\n\nYou can use a Jenkins credential to authenticate the request\n\n[source,groovy]\n----\ndef response = httpRequest authentication: 'my-jenkins-credential-id',\n                           url: 'https://api.github.com/user/jenkinsci'\n----\n\nYou can send an SSL request with authentication by user certificate;\nfor a private CA, make sure to first add the CA certificate is as\n\"Trusted\", then add the user key along with certification chain up\nto same CA certificate, into your PKCS12 keystore file which you\nupload to Jenkins credentials, and you also must use a non-trivial\npassword for that keystore. Keep in mind that for systems under test\nwhich create their own self-signed CA and HTTPS protection, you can\nprogrammatically create and upload the credentials, into a domain\nwhere the job has write access (its folder etc.)\n\n[source,groovy]\n----\ndef response = httpRequest authentication: 'user_with_cert_and_ca',\n                           url: 'https://sut123.local.domain:8443/api/v1/status/debug'\n----\n\nA basic WebDAV upload can be built using ``MKCOL`` and ``PUT`` like so:\n\n[source,groovy]\n----\n// create directory aka a collection\nhttpRequest authentication: 'my-jenkins-credential-id',\n            httpMode: 'MKCOL',\n            // on Apache httpd 201 = collection created, 405 = collection already exists\n            validResponseCodes: '201,405',\n            url: \"https://example.com/webdav-enabled-server/reports/${version}/\"\n// upload a file\nhttpRequest authentication: 'my-jenkins-credential-id',\n            httpMode: 'PUT',\n            validResponseCodes: '201',\n            url: \"https://example.com/reports/${version}/your-report-maybe.html\",\n            uploadFile: './local/path/to/report.html'\n----\n\nFor details on the Pipeline features, use the Pipeline snippet generator in the Pipeline job\nconfiguration.\n\n[WARNING]\n.Known Limitations\n====\nIf Jenkins is restarted before the HTTP response comes back, the build will fail.\n====\n\n== Building\n\nThe plugin can be built and tested locally using a Maven Docker container:\n\n[source, bash]\n----\ndocker run -it --rm -v \"$(pwd)\":/usr/src/mymaven -w /usr/src/mymaven maven:3.3-jdk-8 mvn test\n----\n\n== Configure Global Settings\n\nimage::docs/images/configure-http-request-global.png[]\n\n== Configure Build Step in your Jenkins job\n\nimage::docs/images/configure-http-request-build-step.png[]\n\n== HTTP Request Parameters\n\nParameters are escaped, which means if you try to pass another value inside a value, it will not \nhappen.\n\nIn the example below, the key \"`name`\" will be passed with a value of \"`jenkins\u0026os=linux`\". Note \nthat \"`os`\" is not a parameter - it is part of the value). At the HTTP server-side no parameter \nnamed \"`os`\" will exist.\n\n[CAUTION]\n.Regarding Logging \u0026 Sensitive Information\n====\nEvery execution will log all parameters. Be careful to not pass private information such as \npasswords or personal information.\n====\n\nimage:docs/images/log.png[]\n\n== Issues\n\nReport issues and enhancements in the https://issues.jenkins.io/[Jenkins issue tracker].\nUse the `http-request-plugin` component in the `JENKINS` project.\n\n== Contributing\n\nRefer to our https://github.com/jenkinsci/.github/blob/master/CONTRIBUTING.md[contribution guidelines].\n\n== License\n\nLicensed under link:LICENSE[the MIT License].\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fhttp-request-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Fhttp-request-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fhttp-request-plugin/lists"}