Http Request Node

The http request node is used for making API Requests and receiving the corresponding Responses.

You can also use the http request node for sending and receiving JSON data to a website or API.

Inputs

The http request node supports four Methods:

  • Get - Used to retrieve information from the given URL/server.

  • Post - Used to send data to the server/URL

  • Put - Used to replace the target resource with the given content.

  • Delete - Used to remove the target resource given by a URL

  • -set by msg.method - Use this option if you set the method and URL in the proceeding node.
    In the previous node, use the msg.method and msg.url to set the method and URL respectively.

When using -set by msg.method option in the http request node, leave the URL field empty.

You can give the API or website in the URL field.

Enable secure (SSL/TLS) connection - Enable this to force the connection to use SSL for additional security.

Use basic authentication - Enable this option to give the authentication if the website/API requires authentication to continue.

Return - The response format will be in:

  • UTF-8 string - Standard webpage format

  • Binary buffer - Binary data

  • parsed JSON object - Common response from the APIs. The node will convert JSON data into a JavaScript object.

Name - Display name for the node.

Http Headers

If you want to pass the Http headers for the API/website, you have to set the request headers in any previous node and pass it to the http request node.

Use the below sample code in a function node to set the headers.

msg.header = {}; msg.headers.['content-type'] = 'application/json'; return msg;

Output

The output from the http request node usually contains the payload, statusCode, headers, and responseUrl.

Sample response captured in the debug node.

Usage

The below video captures the usage of the http request node with APIs. https://cdn.orbita.cloud/assets/orbita/experiencedesigner/API.mp4

Related Articles