Handle different http requests with only one http request node?

Hello

I'm (still) quite new with Node-RED (but already very enthusiastic ;-).
I have to send very different http requests to an web API:

  • All http request will have the same request header, namely the actual access token

    but

  • Some request need a GET method, with a specific URL / Endpoint)

  • Some request need a POST method, with a specific URL / endoint AND a specific request body

Does each single request need it's own http-request node, or can I (somehow) inject different headers, methods and URLs into only one, single http-request node?

Kind regards
Roman

If you read the help text (select node and use help tab in sidebar) for the http request node
you can specify

  • method with msg.method get,post etc
  • url with msg.url you can set the get query string here to for get requests
  • headers with msg.headers an object of headers

So you can just use one request node if you wish. You have to select set by msg.method in the method input field of the request node.

1 Like

@E1cid

Thank you very much.
I have read the node help, but I didn't understand, that all mentioned inputs can be used with the msg. - object. I'm still a rookie. :-/

But now, I can go forward.

Kind regards
Roman

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.