# HTTP\_IN payload

**URL:** <https://discourse.nodered.org/t/http-in-payload/77036>\
**Category:** General\
**Created:** [29 March 2023 02:42 UTC](https://discourse.nodered.org/t/http-in-payload/77036 "2023-03-29T02:42:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [29 March 2023 02:42 UTC](https://discourse.nodered.org/t/http-in-payload/77036/1 "2023-03-29T02:42:22Z")

</div>

I have a function:

```auto
var microW_sensor1 = msg.payload.microW_sensor1;
var microW_sensor2 = msg.payload.microW_sensor2;
var url = `mW1=${microW_sensor1}&mW2=${microW_sensor2}`;
var newMsg = { payload: url };
return newMsg;

```

which output this: **mW1=0&mW2=0**.

I need to attach such string to the url ([http://10.0.0.40:1880/buz](http://10.0.0.40:1880/buz)) in a HTTP request node.  
Have tried setting the node using the "Append to query string parameters" and also "Send as body request" but it doesn't work.  
I also tried to format the url in this way `http://10.0.0.40:1880/buz?{{paylod}}` without checking any of the above mentioned options, but again looks like I am not achieving the goal to send [http://10.0.0.40:1880/buz/mW1=0&mW2=0](http://10.0.0.40:1880/buz/mW1=0&mW2=0)  
On the other side I have an HTTP-in node st as GET and buz:name

Where am I mistaken? How do I get the payload (mW1=0&mW2=0) on the HTTP-IN node?  
Thanks for helping

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [29 March 2023 03:19 UTC](https://discourse.nodered.org/t/http-in-payload/77036/2 "2023-03-29T03:19:55Z")

</div>

hi .. the **Append to query** is used in the case that your payload is an object.  
since you are doing some manipulation of the parameters, then you could leave the url of the http-request node empty and construct the whole request url yourself using `msg.url`

```auto
var microW_sensor1 = msg.payload.microW_sensor1;
var microW_sensor2 = msg.payload.microW_sensor2;
var params = `mW1=${microW_sensor1}&mW2=${microW_sensor2}`;

msg.url = `http://10.0.0.40:1880/buz?${params}`

```

Regarding receiving the params in Http-In node .. see example flow  
(change the url to match your server)

```auto
[{"id":"1c3f0d8e352ee364","type":"http in","z":"54efb553244c241f","name":"","url":"/buz","method":"get","upload":false,"swaggerDoc":"","x":330,"y":2680,"wires":[["d8a7664be0b785db","59aa9d8165272e05"]]},{"id":"d8a7664be0b785db","type":"http response","z":"54efb553244c241f","name":"","statusCode":"","headers":{},"x":580,"y":2680,"wires":[]},{"id":"59aa9d8165272e05","type":"debug","z":"54efb553244c241f","name":"debug 262","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":2620,"wires":[]},{"id":"07f76e970ff47079","type":"http request","z":"54efb553244c241f","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":640,"y":2880,"wires":[["10a80b547c666c9f"]]},{"id":"1512e893d5519f30","type":"inject","z":"54efb553244c241f","name":"data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"microW_sensor1\":123,\"microW_sensor2\":456}","payloadType":"json","x":200,"y":2880,"wires":[["3d3dcee0515912d8"]]},{"id":"3d3dcee0515912d8","type":"function","z":"54efb553244c241f","name":"function 2","func":"var microW_sensor1 = msg.payload.microW_sensor1;\nvar microW_sensor2 = msg.payload.microW_sensor2;\nvar params = `mW1=${microW_sensor1}&mW2=${microW_sensor2}`;\n\nmsg.url = `http://localhost:1880/buz?${params}`\n// msg.rejectUnauthorized = false \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":2880,"wires":[["07f76e970ff47079","f9ba359bd22d64d3"]]},{"id":"10a80b547c666c9f","type":"debug","z":"54efb553244c241f","name":"debug 263","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":2880,"wires":[]},{"id":"f9ba359bd22d64d3","type":"debug","z":"54efb553244c241f","name":"debug 264","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":570,"y":2820,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [29 March 2023 03:59 UTC](https://discourse.nodered.org/t/http-in-payload/77036/3 "2023-03-29T03:59:54Z")

</div>

Thanks a million. It did work perfectly. Really appreciate your help.

---

<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:** [12 April 2023 03:59 UTC](https://discourse.nodered.org/t/http-in-payload/77036/4 "2023-04-12T03:59:58Z")

</div>

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