# Choose Http Post node

**URL:** <https://discourse.nodered.org/t/choose-http-post-node/48382>\
**Category:** General\
**Created:** [13 July 2021 20:52 UTC](https://discourse.nodered.org/t/choose-http-post-node/48382 "2021-07-13T20:52:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zamzon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zamzon/32/15521_2.png) [@zamzon](https://discourse.nodered.org/u/zamzon)\
**Post date:** [13 July 2021 20:52 UTC](https://discourse.nodered.org/t/choose-http-post-node/48382/1 "2021-07-13T20:52:14Z")

</div>

Hi

I need to make an HTTP POST call, but I'm not quite sure which node to use and where to put my information

I need to make a POST call to [http://ubisys-g1-2836/api/v1/devices/d9/e1/Light/OnOff/OnState/](http://ubisys-g1-2836/api/v1/devices/d9/e1/Light/OnOff/OnState/)

Header value:  
The header key "Authorization" with the following value "bearer ocnzAwYT2FvR0IfpwIDqSf5dRJXztIWb7CChkd4blQ4 ="

Body Value:  
{"value": false} or {"value": true}

thanks in advance

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 July 2021 20:54 UTC](https://discourse.nodered.org/t/choose-http-post-node/48382/2 "2021-07-13T20:54:12Z")

</div>

See HTTP request examples in the cookbook

"Node-RED Cookbook : Node-RED" [https://cookbook.nodered.org#http-requests](https://cookbook.nodered.org#http-requests)

---

<div class="post-metadata">

**Author:** ![zamzon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zamzon/32/15521_2.png) [@zamzon](https://discourse.nodered.org/u/zamzon)\
**Post date:** [13 July 2021 22:11 UTC](https://discourse.nodered.org/t/choose-http-post-node/48382/3 "2021-07-13T22:11:47Z")

</div>

Thanks.

I cant see how to insert a body in the http request node.

I did try to send a msg.body = {"value": false}; in a function, but that did not work

```auto
[{"id":"cb1dfcde.fd153","type":"function","z":"f3ad92f.bcc277","name":"set payload and headers","func":"//msg.payload = \"data to post\";\nmsg.headers = {};\nmsg.headers['Authorization'] = 'bearer ocnzAwYT2FvR0IfpwIDqSf5dRJXztIWb7CChkd4blQ4=';\n//msg.url = \"http://192.168.0.170/api/v1/\";\nmsg.url = \"http://192.168.0.170/api/v1/devices/d9/e1/Light/OnOff/OnState\";\nmsg.method = \"POST\";\nmsg.body = {};\nmsg.body = {\"value\": false};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390,"y":320,"wires":[["e44209e7.752698"]]},{"id":"dcf34aab.218928","type":"inject","z":"f3ad92f.bcc277","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":200,"y":320,"wires":[["cb1dfcde.fd153"]]},{"id":"e44209e7.752698","type":"http request","z":"f3ad92f.bcc277","name":"post to HttpBin","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":600,"y":240,"wires":[["ee306582.f0dde8"]]},{"id":"ee306582.f0dde8","type":"debug","z":"f3ad92f.bcc277","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":320,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 July 2021 22:50 UTC](https://discourse.nodered.org/t/choose-http-post-node/48382/4 "2021-07-13T22:50:10Z")

</div>

Read the built in help by selecting the HTTP request node then looking in the right hand side bar book tab. I'm not near a computer but from memory, set msg.payload with your data.

---

<div class="post-metadata">

**Author:** ![zamzon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zamzon/32/15521_2.png) [@zamzon](https://discourse.nodered.org/u/zamzon)\
**Post date:** [14 July 2021 19:29 UTC](https://discourse.nodered.org/t/choose-http-post-node/48382/5 "2021-07-14T19:29:57Z")

</div>

Thanks it worked with msg.payload

---

<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:** [28 July 2021 19:30 UTC](https://discourse.nodered.org/t/choose-http-post-node/48382/6 "2021-07-28T19:30:31Z")

</div>

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