Skip to main content

httpRequest

Perform a generic HTTP request, for example to an API.

Fields

FieldTypeDescriptionDefault
idstringOptional. ID of the step.Generated UUID
descriptionstringOptional. Description of the step.
actionstringRequired. Action to perform.
urlstringRequired. URL for the HTTP request.
statusCodesarray of integersOptional. Accepted status codes. If the specified URL returns a code other than what is specified here, the action fails.[200]
methodstringOptional. Method of the HTTP request

Accepted values: get, put, post, patch, delete
get
timeoutintegerOptional. Timeout for the HTTP request, in milliseconds.60000
requestHeadersobjectOptional. Headers to include in the HTTP request, in key/value format.{}
responseHeadersobjectOptional. Headers expected in the response, in key/value format. If one or more responseHeaders entries aren't present in the response, the step fails.{}
requestParamsobjectOptional. URL parameters to include in the HTTP request, in key/value format.{}
responseParamsobjectOptional. DEPRECATED.{}
requestDataobjectOptional. JSON object to include as the body of the HTTP request.{}
responseDataobjectOptional. JSON object expected in the response. If one or more key/value pairs aren't present in the response, the step fails.{}
allowAdditionalFieldsbooleanOptional. If false, the step fails when the response data contains fields not specified in responseData.true
savePathstringOptional. File path to save the command's output, relative to saveDirectory. Specify a file extension that matches the expected response type, such as .json for JSON content or .txt for strings.
saveDirectorystringOptional. Directory to save the command's output. If the directory doesn't exist, creates the directory. If not specified, the directory is your media directory.
maxVariationintegerOptional. Allowed variation in percentage of text different between the current output and previously saved output. If the difference between the current output and the previous output is greater than maxVariation, the step fails. If output doesn't exist at savePath, this value is ignored.0
overwritestringOptional. If true, overwrites the existing output at savePath if it exists.
If byVariation, overwrites the existing output at savePath if the difference between the new output and the existing output is greater than maxVariation.

Accepted values: true, false, byVariation
false
envsFromResponseDataarray of objectsOptional. Environment variables to set based on response variables, as an object of the environment variable name and the jq filter applied to the response data to identify the variable's value.[]
envsFromResponseData.namestringRequired. Name of the environment variable to set.
envsFromResponseData.jqFilterstringRequired. jq filter to apply to the response data. If the filter doesn't return a value, the environment variable isn't set.

Examples

{
"action": "httpRequest",
"url": "https://reqres.in/api/users"
}
{
"action": "httpRequest",
"url": "https://reqres.in/api/users/2",
"method": "put",
"requestData": {
"name": "morpheus",
"job": "zion resident"
}
}
{
"action": "httpRequest",
"url": "https://reqres.in/api/users",
"method": "post",
"requestData": {
"name": "morpheus",
"job": "leader"
},
"responseData": {
"name": "morpheus",
"job": "leader"
},
"statusCodes": [
200,
201
]
}
{
"action": "httpRequest",
"url": "https://www.api-server.com",
"method": "post",
"timeout": 30000,
"requestHeaders": {
"header": "value"
},
"requestParams": {
"param": "value"
},
"requestData": {
"field": "value"
},
"responseHeaders": {
"header": "value"
},
"responseData": {
"field": "value"
},
"statusCodes": [
200
]
}
{
"action": "httpRequest",
"url": "https://reqres.in/api/users",
"method": "post",
"requestData": {
"name": "morpheus",
"job": "leader"
},
"responseData": {
"name": "morpheus",
"job": "leader"
},
"statusCodes": [
200,
201
],
"savePath": "response.json",
"saveDirectory": "media",
"maxVariation": 5,
"overwrite": "byVariation"
}