Calling REST api

Hi.

I want to know how to call a given rest api with a request body and get the response from node-red

eg:
header:
Content-Type: application/json
body:
{
“key1”:“value1”,
“key2”:“value2”
}

Thank you.

what have you tried?

Have you read the info panel on the http-request node?

I found the answer.
we need to use 4 nodes.

  1. inject
  2. change
  3. http request
  4. debug

set headers as rules(msg.headers) in change node.
set body as rules(msg.payload) in change node
set endpoint in http request node

after connecting those nodes click on the inject node. then the request will be gone and response will be received

Thanks for replying…

Do you know which node to be used to access the elements in the http response received.
I want to get the elements in the json object.
Thanks

Yes as per the answer in the other thread.