Skip to main content

httpRequest

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

Fields

FieldTypeDescriptionDefault
urlstringOptional. URL for the HTTP request.
openApiunknownOptional. No description provided.
statusCodesarray of integerOptional. Accepted status codes. If the specified URL returns a code other than what is specified here, the action fails.[200,201]
methodstringOptional. Method of the HTTP request

Accepted values: get, put, post, patch, delete
get
timeoutintegerOptional. Timeout for the HTTP request, in milliseconds.60000
requestobjectOptional. No description provided.
request.headersobjectOptional. Headers to include in the HTTP request, in key/value format.{}
request.parametersobjectOptional. URL parameters to include in the HTTP request, in key/value format.{}
request.bodyOne of
- object
- array of unknown
- string
Optional. JSON object to include as the body of the HTTP request.{}
responseobjectOptional. No description provided.
response.headersobjectOptional. Headers expected in the response, in key/value format. If one or more responseHeaders entries aren't present in the response, the step fails.{}
response.bodyOne of
- object
- array of unknown
- string
Optional. 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 the response body.true
pathstringOptional. File path to save the command's output, relative to directory. Specify a file extension that matches the expected response type, such as .json for JSON content or .txt for strings.
directorystringOptional. 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.
maxVariationnumberOptional. 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 path, this value is ignored.0
overwritestringOptional. If true, overwrites the existing output at path if it exists.
If aboveVariation, overwrites the existing output at path if the difference between the new output and the existing output is greater than maxVariation.

Accepted values: true, false, aboveVariation
aboveVariation

Examples

"https://reqres.in/api/users"
{
"url": "https://reqres.in/api/users"
}
{
"url": "https://reqres.in/api/users/2",
"method": "put",
"request": {
"body": {
"name": "morpheus",
"job": "zion resident"
}
}
}
{
"url": "https://reqres.in/api/users",
"method": "post",
"request": {
"body": {
"name": "morpheus",
"job": "leader"
}
},
"response": {
"body": {
"name": "morpheus",
"job": "leader"
}
},
"statusCodes": [
200,
201
]
}
{
"url": "https://www.api-server.com",
"method": "post",
"timeout": 30000,
"request": {
"body": {
"field": "value"
},
"headers": {
"header": "value"
},
"parameters": {
"param": "value"
}
},
"response": {
"body": {
"field": "value"
},
"headers": {
"header": "value"
}
},
"statusCodes": [
200
]
}
{
"url": "https://reqres.in/api/users",
"method": "post",
"request": {
"body": {
"name": "morpheus",
"job": "leader"
}
},
"response": {
"body": {
"name": "morpheus",
"job": "leader"
}
},
"statusCodes": [
200,
201
],
"path": "response.json",
"directory": "media",
"maxVariation": 0.05,
"overwrite": "aboveVariation"
}
{
"openApi": "getUserById"
}
{
"openApi": {
"name": "Reqres",
"operationId": "getUserById"
},
"request": {
"parameters": {
"id": 123
}
}
}
{
"openApi": {
"descriptionPath": "https://api.example.com/openapi.json",
"operationId": "getUserById"
},
"request": {
"parameters": {
"id": 123
}
}
}
{
"openApi": {
"descriptionPath": "https://api.example.com/openapi.json",
"operationId": "createUser",
"useExample": "both"
}
}
{
"openApi": {
"descriptionPath": "https://api.example.com/openapi.json",
"operationId": "updateUser",
"useExample": "request",
"exampleKey": "acme"
}
}
{
"openApi": {
"descriptionPath": "https://api.example.com/openapi.json",
"operationId": "updateUser",
"useExample": "request",
"exampleKey": "acme",
"headers": {
"Authorization": "Bearer $TOKEN"
}
}
}