Learning about the input/output parameters of a node
Of the many nodes that Node-RED has, not many are suitable for calling web APIs (REST APIs). A typical node used when calling the web API is the http request
node.
To call an external API on Node-RED, simply set the endpoint URL of the API to the URL property of the http request
node.
For example, when it is necessary to set a parameter in the endpoint URL when calling an API, it is possible to set the output value of the previous node connected. The method is very easy. Instead of a literal string, you can just set the {{payload}}
variable in the value setting part of the parameter.
In {{payload}}
, the character string inherited from the previous processing node is entered.
Take the following example (note that this URL does not exist): http://api-test.packt.com/foo?username={{payload}}&format=json
:
The process...