# Incrementing HTTP Post

**URL:** <https://discourse.nodered.org/t/incrementing-http-post/4513>\
**Category:** General\
**Created:** [2 November 2018 20:10 UTC](https://discourse.nodered.org/t/incrementing-http-post/4513 "2018-11-02T20:10:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sweetwater](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sweetwater](https://discourse.nodered.org/u/sweetwater)\
**Post date:** [2 November 2018 20:10 UTC](https://discourse.nodered.org/t/incrementing-http-post/4513/1 "2018-11-02T20:10:46Z")

</div>

I have a situation where I am sending a HTTP Post command to a series of IP devices.  
The IP devices have sequential IP address  
For example:  
192.168.1.1  
192.168.1.2...  
192.168.1.100

I have tried the attached flow , although the debug shows it is sending out the correct msg.url as expected the commands are not being executed in the HTTP node.

Any suggestions?

* * *

```auto
[{"id":"1e8207bc.ac5ba8","type":"function","z":"2d9d8e01.84ef32","name":"","func":"var counter = msg.payload;\nvar TxCh =global.get('TXChSelected');\nvar temp = global.get(\"HddsxRxSelected\");\nvar RX_IP = 'http://172.31.3.';\nvar CGI_switch_command = '/cgi-bin/query.cgi?cmd=rxswitch:';\n\n\nif(counter <=10){\n msg.payload = counter++;\n msg.url = RX_IP+counter+CGI_switch_command+'00'+TxCh;\n return msg;\n}\n\n\n","outputs":1,"noerr":0,"x":750,"y":300,"wires":[["9f34c62f.36f478","63630687.c39168","d252a40e.5d1058"]]},{"id":"5a835f2d.c7a11","type":"delay","z":"2d9d8e01.84ef32","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":820,"y":200,"wires":[["1e8207bc.ac5ba8"]]},{"id":"f2a266af.4562d8","type":"inject","z":"2d9d8e01.84ef32","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":300,"wires":[["1e8207bc.ac5ba8"]]},{"id":"9f34c62f.36f478","type":"function","z":"2d9d8e01.84ef32","name":"++","func":"\n msg.payload = msg.payload+1;\n return msg;\n\n\n","outputs":1,"noerr":0,"x":690,"y":200,"wires":[["5a835f2d.c7a11"]]},{"id":"63630687.c39168","type":"http request","z":"2d9d8e01.84ef32","name":"Switch RX","method":"POST","ret":"txt","url":"","tls":"","x":950,"y":300,"wires":[[]]},{"id":"d252a40e.5d1058","type":"debug","z":"2d9d8e01.84ef32","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"url","x":890,"y":380,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 November 2018 22:07 UTC](https://discourse.nodered.org/t/incrementing-http-post/4513/2 "2018-11-02T22:07:06Z")

</div>

In order for your flow to be importable it is necessary to put a line containing three backtick characters before it, and another such line after it. You can edit your post to put them in.

---

<div class="post-metadata">

**Author:** ![sweetwater](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sweetwater](https://discourse.nodered.org/u/sweetwater)\
**Post date:** [3 November 2018 14:33 UTC](https://discourse.nodered.org/t/incrementing-http-post/4513/3 "2018-11-03T14:33:47Z")

</div>

Thank you Colin for the info. I have wrapped the example code with ~~~ and it is below.

```auto
[{"id":"1e8207bc.ac5ba8","type":"function","z":"2d9d8e01.84ef32","name":"","func":"var counter = msg.payload;\nvar TxCh =global.get('TXChSelected');\nvar temp = global.get("HddsxRxSelected");\nvar RX_IP = '[http://172.31.3](http://172.31.0.3/).';\nvar CGI_switch_command = '/cgi-bin/query.cgi?cmd=rxswitch:';\n\n\nif(counter &lt;=10){\n msg.payload = counter++;\n msg.url = RX_IP+counter+CGI_switch_command+'00'+TxCh;\n return msg;\n}\n\n\n","outputs":1,"noerr":0,"x":750,"y":300,"wires":[["9f34c62f.36f478","63630687.c39168","d252a40e.5d1058"]]},{"id":"5a835f2d.c7a11","type":"delay","z":"2d9d8e01.84ef32","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":820,"y":200,"wires":[["1e8207bc.ac5ba8"]]},{"id":"f2a266af.4562d8","type":"inject","z":"2d9d8e01.84ef32","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":300,"wires":[["1e8207bc.ac5ba8"]]},{"id":"9f34c62f.36f478","type":"function","z":"2d9d8e01.84ef32","name":"++","func":"\n msg.payload = msg.payload+1;\n return msg;\n\n\n","outputs":1,"noerr":0,"x":690,"y":200,"wires":[["5a835f2d.c7a11"]]},{"id":"63630687.c39168","type":"http request","z":"2d9d8e01.84ef32","name":"Switch RX","method":"POST","ret":"txt","url":"","tls":"","x":950,"y":300,"wires":[[]]},{"id":"d252a40e.5d1058","type":"debug","z":"2d9d8e01.84ef32","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"url","x":890,"y":380,"wires":[]}] 

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 November 2018 14:42 UTC](https://discourse.nodered.org/t/incrementing-http-post/4513/4 "2018-11-03T14:42:48Z")

</div>

They should be backtick characters, not tildes. And make sure they are on separate lines one before and one after. You can check whether it is right by trying to import it yourself from your post. You don't need to re-post, just edit the previous post using the pen icon at the bottom of the post.
