Using Http client

You can extend the flow by using REST API calls. External REST API can be called by using the following nodes 'Http Client' and 'Config'.

  • Config : Defines a key, value pair to be used in Http Request.
    • Saved as a 'flow' object and named as 'metadata'.
    • Refer to the javascript below when you need to get a defined data at 'Config' nodes.
    • Get a value of metadata with the flow scope context.
// Get values defined in 'Config' node

let metadata = flow.get('metadata');
console.log(metadata['%key%']);
  • Http Client : Sends an HTTP request and returns the following response:
    • inputs
      • Sets the URL and Method value.
      • Able to define the msg.headers, msg.cookie, msg.payload to make requests.
    • outputs
      • Defines the return data format, e.g. JSON / UTF-8 string / binary buffer.
      • The next node of the 'Http Client' and receives the 'msg' object with the following properties msg.payload, msg.statusCode, msg.headers, msg.responseUrl, and msg.responseCookies.

Example

A Rest API Call example using 'Http Client', 'Config', 'Function' Nodes.

  1. Set the API request.
  2. Set the metadata for API.
  3. Set the API request header.