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_FORM_DATA
, APPLICATION_JSON
, APPLICATION_JSON_UTF8
, APPLICATION_TAR
, APPLICATION_ZIP
, APPLICATION_OCTETSTREAM
authentication : String
(optional)
consoleLogResponseBody : boolean
(optional)
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_FORM_DATA
, APPLICATION_JSON
, APPLICATION_JSON_UTF8
, APPLICATION_TAR
, APPLICATION_ZIP
, APPLICATION_OCTETSTREAM
customHeaders
(optional)
name : String
value : String
maskValue : boolean
formData
(optional)
uploadFile : String
name : String
fileName : String
contentType : String
body : String
httpMode
(optional)
GET
, HEAD
, POST
, PUT
, DELETE
, OPTIONS
, PATCH
, MKCOL
httpProxy : String
(optional)
ignoreSslErrors : boolean
(optional)
multipartName : String
(optional)
outputFile : String
(optional)
proxyAuthentication : String
(optional)
quiet : boolean
(optional)
requestBody : String
(optional)
The raw body of the request.
Parameters will be resolved.
responseHandle
(optional)
NONE
, LEAVE_OPEN
, STRING
timeout : int
(optional)
uploadFile : String
(optional)
useNtlm : boolean
(optional)
useSystemProperties : boolean
(optional)
validResponseCodes : String
(optional)
validResponseContent : String
(optional)
wrapAsMultipart : boolean
(optional)
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.