Skip to content

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 request

  • Headers
    Headers for the request

  • Body
    Payload for the request

  • Fallback
    Execute when failed or error making an HTTP request.

Response

Handle the response of the request.

  • Response type
    Type of the response, defaults to JSON.

  • 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 }
    		]
    	}
    }

    To get the values array, write data.values as the path. And to get the first value of the values array, write data.values.0.

    INFO

    Input $response if you want to get all the HTTP Response like status, 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

json
[
	["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,

json
[
	["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,
json
{
	"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,
json
{
	"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,
json
{
	"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.

json
{
	"profile": {{$stringify(variables.userProfile)}},
	"stats": {{$stringify(variables.stats)}}
}