HTTP request

Make a HTTP request to the given URL. In most cases, you should use the **Data** section in the global toolbar to configure a REST resource instead.

Make a HTTP request to the given URL.

In most cases, you should use Data in the top toolbar to configure a new REST resource instead, as that allows you to define explicit schemas for the request/response, required headers, allowed query parameters and more.

You can choose the method and customize headers for the request. For methods than GET, you can also include a request body.

If the request is successful (i.e. the response status code is within 200 range), the first output is triggered. The second output is triggered if the response status code is within the range of 400 - 500.

The third output is triggered if error occures while trying to make a HTTP request to the give URL.

The flow function returns the response body in raw text format, and as parsed JSON if possible.

By default, the Content-Type: application/json and Accept: application/json headers are included in the request.

If you change the Request body type to x-www-form-urlencoded, the Content-Type: application/x-www-form-urlencoded header is included instead.

To upload and download binary files, consider using the Download file, Upload file and Upload multiple files flow functions instead.

Input arguments

Label

Key

Type

Required?

Default

Description

URL

url

String(web-url)

Yes

Target URL for the request.

HTTP method

method

String

Yes

GET

HTTP method to use

Headers

headers

Array

No

Headers to include in the HTTP call.

Request body

body

Json

No

JSON body to send with the request. If HTTP method is GET, this argument is ignored.

Request body type

bodyType

String

No

json

Request body type. If x-www-form-urlencoded is chosen, Request body is expected to be a flat object that is converted to the required key-value pairs.

Output arguments

Number of outputs: 3

Label

Key

Type

Description

Response status code

statusCode

Number

HTTP response status code.

Response status message

statusText

String

Status message corresponding to the status code, e.g. OK for 200.

Response headers

resHeaders

Object

HTTP response headers.

Old response body

resBody

Json

This should be used for backwards compatibility purposes only, this output should not be used in new apps.

If you have resBody in use, please consider switching to resBodyParsed. | | Raw response body | resBodyRaw | String | HTTP response body in text format. | | Response body in json format | resBodyParsed | Json | HTTP response body as parsed JSON. |

Events

No events.

Errors

Label

Code

Description

Request failed

requestFailed

Thrown if the entire request failed due to e.g. CORS issues or no network connectivity.

Unknown body type

unknownBodyType

Thrown if the request body type is not in json format.

Body not stringfiable

bodyNotStringifiable

Thrown if the request body could not be stringified.

HTTP error

httpError

Thrown if the URL responded with status code that is not ´2XX´, ´4XX´, ´5XX´).

Unknown error

unknown

Thrown if an unknown error occurred while making the HTTP request.