# Http GET with JSON payload?

**URL:** <https://discourse.nodered.org/t/http-get-with-json-payload/50166>\
**Category:** Developing Nodes\
**Tags:** http-request\
**Created:** [25 August 2021 15:58 UTC](https://discourse.nodered.org/t/http-get-with-json-payload/50166 "2021-08-25T15:58:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [25 August 2021 15:58 UTC](https://discourse.nodered.org/t/http-get-with-json-payload/50166/1 "2021-08-25T15:58:02Z")

</div>

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

For example if I use an inject node with this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0db6f8a49fe1f30618bf2f763cefa5016d887345.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/449866f670f72765ae2f59f47fa945becfa09703.png)

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

```

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/3/f3c036fca728ddcc7985b4c0cf8736d3142815b5.png)

Looks like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/c/bc2520dfbb78c0dc788bb14abc2da8b4803d6c28.png)

The rest API fails returns some Python language:

```auto
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.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/784bbd7e851cfbe371b35c143ca2b7ed784d5d60.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 August 2021 16:10 UTC](https://discourse.nodered.org/t/http-get-with-json-payload/50166/2 "2021-08-25T16:10:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [25 August 2021 17:15 UTC](https://discourse.nodered.org/t/http-get-with-json-payload/50166/3 "2021-08-25T17:15:06Z")

</div>

Headers tab in insomnia

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/2/227b71db00de59156034b740f4ae2cef996cd321.png)

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [25 August 2021 17:17 UTC](https://discourse.nodered.org/t/http-get-with-json-payload/50166/4 "2021-08-25T17:17:55Z")

</div>

Do I need this? Its a link on how to incorporate headers for node red requests. [Set a request header : Node-RED](https://cookbook.nodered.org/http/set-request-header)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 August 2021 17:18 UTC](https://discourse.nodered.org/t/http-get-with-json-payload/50166/5 "2021-08-25T17:18:57Z")

</div>

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:

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

```

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

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [25 August 2021 17:21 UTC](https://discourse.nodered.org/t/http-get-with-json-payload/50166/6 "2021-08-25T17:21:37Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/1/011067ee8b48de19ac446178c77eb8b70dee0bd6.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 October 2021 17:22 UTC](https://discourse.nodered.org/t/http-get-with-json-payload/50166/7 "2021-10-24T17:22:10Z")

</div>

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