# Getting funky with http request node?

**URL:** <https://discourse.nodered.org/t/getting-funky-with-http-request-node/77778>\
**Category:** General\
**Created:** [21 April 2023 07:37 UTC](https://discourse.nodered.org/t/getting-funky-with-http-request-node/77778 "2023-04-21T07:37:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [21 April 2023 07:37 UTC](https://discourse.nodered.org/t/getting-funky-with-http-request-node/77778/1 "2023-04-21T07:37:42Z")

</div>

I am trying to translate the following curl command to a NR http request node. Of course, I could just use an exec node and the curl CLI, but that would be too easy.

curl -H "BOND-Token: AAA" -i [http://192.168.1.12/v2/devices/AAA/actions/TurnLightOff](http://192.168.1.12/v2/devices/AAA/actions/TurnLightOff) -X PUT -d "{}"

The header is pretty straight forward...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/0/c0df4486747e388a009a801d89c1bead89b9a902.png)

The URL seems clear?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6f45df7aff6dfe9517ebf692789428b6ac294289.png)

But something is not right, I get ECONNREST as the result?

The AAA is redacted value, since I don't want to publish the 'token' information nor the device name, in both cases just a string value.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [21 April 2023 08:24 UTC](https://discourse.nodered.org/t/getting-funky-with-http-request-node/77778/2 "2023-04-21T08:24:53Z")

</div>

Just a quick sanity check.

Have you set the Method to `PUT` in the request node and provided an empty object, in the form of a `payload`?

~~I would also suggest adding another header -\> `Content-Type` set to `application/json`~~  
~~By default it will be set to `multipart/form-data` and this maybe what is happening.~~

EDIT:  
Its the other way around 😅  
so check the method, and attach an empty object

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [24 April 2023 04:24 UTC](https://discourse.nodered.org/t/getting-funky-with-http-request-node/77778/3 "2023-04-24T04:24:32Z")

</div>

Yea, the injection is empty topic and empty payload. But I realized payload actually must be '{}' not null. That was the trick the given REST API required.

---

<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:** [8 May 2023 04:25 UTC](https://discourse.nodered.org/t/getting-funky-with-http-request-node/77778/4 "2023-05-08T04:25:04Z")

</div>

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