Skip to content

HTTP-Request Node

The HTTP-Request-node allows for making web requests, in order to retrieve data from external resources such as databases or web APIs.

HTTP-Request Node
Method GET, POST, PUT, PATCH, DELETE, HEAD
Variable name The name of the variable with curly brackets. This variable will hold the response data.
URL The URL from which to make the web request.
Headers List of HTTP request headers.
Single-row response If the resource returns an array of items, only grab the first item.

request

Parameters

To pass parameters in a request, add a question mark after the URL.
Format the parameters as variable_name=value.
Multiple parameters should be separated by an ampersand symbol (&)

https://www.example.com?parameter1="hello"&parameter2="world"

You can use variables in your URL parameters as well.

https://www.example.com?parameter1="{variable1}"&parameter2="{variable2}"

Headers

Using headers, you can pass additional information to your resource. This is often used for API authorization, content type indication, etc. Using variables you can pass in dynamic values as illustrated in the figure below.

request

In this example we are passing a token into the Authorization header. The token is a variable created elsewhere in the project. You can also pass plain text as the header value demonstrated in the Content-Type header.

Using the response data

The response data is saved in the variable you indicated. The content of the variable will contain the exact response structure from the service you requested. This could be raw text, JSON or some other format. Take care to check the structure of the expected response. To demonstrate we can take a simple example.

A GET request to https://api.agify.io/?name={name} will return a JSON structure as defined below:

{
  name: String,
  age: Integer,
  count: Integer,
}

Take a look at the following HTTP request node example. Note that we use a variable to form a dynamic query.

http node example

We capture the response in a variable called response and we can use this data in our application, either in scripts or in other nodes.

You could write out the response data in a Say node like so:

http node example

If your response contains an array of elements in JSON format you can use array notation to access specific indexes.

http node example