Http GET with JSON payload?

Can I make a GET request with a JSON payload in the body?

For example if I use an inject node with this:

{
    "address": "12345:2",
    "object_type": "analogInput",
    "object_instance": "2"
}

And feed this into the block of an HTTP request node:

Looks like this:

The rest API fails returns some Python language:

info: "'NoneType' object is not subscriptable"

status: "fail"

Any ideas to try? I can seem to make this work with insomnia, send a JSON payload in a GET and get a response like this screen shot below I am trying to recreate in node red.

Can you check what is on the 'Header' tab in insomnia - you may be missing a required header.

Headers tab in insomnia

Do I need this? Its a link on how to incorporate headers for node red requests. Set a request header : Node-RED

That shows you are missing the content-type header.

In your Inject node, add a property called headers, set its type to JSON and set its value to:

{"content-type": "application/json"}

edit: yes, that cookbook link will work as well. Either approach is good

Sweet that worked thank you so much just incorporating it into the inject node.

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