The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.
For a list of other such plugins, see the Pipeline Steps Reference page.
httpRequest
: Perform an HTTP Request and return a response objectPerforms an HTTP request, and returns a response object.
Usage example:
def response = httpRequest 'http://localhost:8080/jenkins/api/json?pretty=true' println("Status: "+response.status) println("Content: "+response.content)
If Jenkins restarts after the HTTP request is made, but before the HTTP response is received, the HTTP request fails.
validResponseCodes is a comma-separated string of single values or from:to ranges. For example '200' to accept only 200 or '201,301:303' to accept 201 as well as the range from 301 to 303.
The methods of the response object are:
url
String
acceptType
(optional)
Accept: foo
HTTP request header where foo
is the HTTP content type to accept.
NOT_SET
, TEXT_HTML
, TEXT_PLAIN
, APPLICATION_FORM
, APPLICATION_JSON
, APPLICATION_JSON_UTF8
, APPLICATION_TAR
, APPLICATION_ZIP
, APPLICATION_OCTETSTREAM
authentication
(optional)
String
consoleLogResponseBody
(optional)
boolean
contentType
(optional)
Content-Type: foo
HTTP request header where foo
is the HTTP content type the request is using.
NOT_SET
, TEXT_HTML
, TEXT_PLAIN
, APPLICATION_FORM
, APPLICATION_JSON
, APPLICATION_JSON_UTF8
, APPLICATION_TAR
, APPLICATION_ZIP
, APPLICATION_OCTETSTREAM
customHeaders
(optional)
name
String
value
String
maskValue
boolean
httpMode
(optional)
GET
, HEAD
, POST
, PUT
, DELETE
, OPTIONS
, PATCH
httpProxy
(optional)
String
ignoreSslErrors
(optional)
boolean
multipartName
(optional)
String
outputFile
(optional)
String
proxyAuthentication
(optional)
String
quiet
(optional)
boolean
requestBody
(optional)
The raw body of the request.
Parameters will be resolved.
String
responseHandle
(optional)
NONE
, LEAVE_OPEN
, STRING
timeout
(optional)
int
uploadFile
(optional)
String
useNtlm
(optional)
boolean
useSystemProperties
(optional)
boolean
validResponseCodes
(optional)
String
validResponseContent
(optional)
String
wrapAsMultipart
(optional)
boolean
Please submit your feedback about this page through this quick form.
Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?
See existing feedback here.