HTTP Request Block
Make an HTTP Request.
Method
Request's method (GET
,POST
, etc.)URL
URL of the request.Content type
Content-Type
header for the requestHeaders
Headers for the requestBody
Payload for the requestFallback
Execute when failed or error making an HTTP request.
Response
Handle the response of the request.
Response type
Type of the response, defaults toJSON
.Data path
The dot notation to the data of the response. For example, when the response is returning these data:json{ "status": 200, "data": { "name": "Prices", "values": [ { "id": 1, "value": 4000 }, { "id": 2, "value": 24000 } ] } }
{ "status": 200, "data": { "name": "Prices", "values": [ { "id": 1, "value": 4000 }, { "id": 2, "value": 24000 } ] } }
To get the
values
array, writedata.values
as the path. And to get the first value of thevalues
array, writedata.values.0
.INFO
Input
$response
if you want to get all the HTTP Response likestatus
,statusText
,data
, etc.Assign to variable
Whether assign the value into a variable or not.Variable name
Name of the variable to assign the value.Insert to table
Whether insert the value into the table or not.Select column
The column where the value will be inserted.
Form Data
When using the multipart/form-data
as the header, the request body will be sent as FormData. And because of that, you must follow the below format when writing the body
[
["name", "value"],
["name 2", "value 2"]
]
[
["name", "value"],
["name 2", "value 2"]
]
In the value field, you can write the absolute path of the file in your local computer or the URL of the file you want to upload. For example,
[
["audio", "C:\\Downloads\\files\\music.mp3"],
["image", "https://example.com/image.png"]
]
[
["audio", "C:\\Downloads\\files\\music.mp3"],
["image", "https://example.com/image.png"]
]
Writing Expression Inside the Body
When writing expressions inside the body to access data like variables, table, etc, is a bit tricky because the end result of it must be a valid JSON.. And to prevent the "Content body is not valid JSON" error, follow these rules:
- String value
If the value of the data you reference is a string, you must wrap the mustache tag inside a double-quote ("). For example,
{
"name": "{{variables.name}}",
"email": "{{variables.email}}"
}
{
"name": "{{variables.name}}",
"email": "{{variables.email}}"
}
- Multiline string value
If the value of the data you reference is a string and has a new line in it, you must add an exclamation mark(!) before writing the keyword of the data. For example,
{
"longText": {{!variables.article}}
}
{
"longText": {{!variables.article}}
}
INFO
This is not required when using JavaScript Expressions.
- Other
If the value of the data you reference is object, array, etc, you can directly write the mustache tag inside the body. For example,
{
"profile": {{variables.userProfile}}, // { name: 'John Doe', email: 'john@example.com' }
"stats": {{variables.stats}} // [10, 200, 87, 21]
}
{
"profile": {{variables.userProfile}}, // { name: 'John Doe', email: 'john@example.com' }
"stats": {{variables.stats}} // [10, 200, 87, 21]
}
If you're JavaScript Expressions, you need to wrap the expression inside the $stringify
function.
{
"profile": {{$stringify(variables.userProfile)}},
"stats": {{$stringify(variables.stats)}}
}
{
"profile": {{$stringify(variables.userProfile)}},
"stats": {{$stringify(variables.stats)}}
}