# Best way to run a curl command?

**URL:** https://discourse.nodered.org/t/best-way-to-run-a-curl-command/29594
**Category:** General
**Created:** [6 July 2020 11:00 UTC](https://discourse.nodered.org/t/best-way-to-run-a-curl-command/29594 "2020-07-06T11:00:06Z")
**Posts on this page:** 1
**Showing post:** 7

<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: [6 July 2020 18:15 UTC](https://discourse.nodered.org/t/best-way-to-run-a-curl-command/29594/7 "2020-07-06T18:15:36Z")

</div>

I'm not certain why everyone is talking about exec node `:confused:` am i missing something?

> [@craigcurtin](#):
>
> however i was wondering is there any node that will essentially take a curl commandline and encapsulate it or convert it for use within NR itself rather than execing out

There is not a node to do the work for you - but it isn't that difficult to do by hand.

Here is how you translate a simple CURL to "The node-red way"

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

```auto
[{"id":"3fbcc579.1dc12a","type":"inject","z":"60184b60.424444","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":800,"y":140,"wires":[["37d01ae9.869d66"]]},{"id":"dea77fd.b480f8","type":"http request","z":"60184b60.424444","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.amberelectric.com.au/prices/listprices","tls":"","persist":false,"proxy":"","authType":"","x":950,"y":260,"wires":[["261e81ee.00f02e"]]},{"id":"37d01ae9.869d66","type":"change","z":"60184b60.424444","name":"","rules":[{"t":"set","p":"headers","pt":"msg","to":"{\"Content-Type\":\"application/json\"}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"{\"postcode\":\"2069\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":200,"wires":[["dea77fd.b480f8"]]},{"id":"261e81ee.00f02e","type":"debug","z":"60184b60.424444","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":990,"y":320,"wires":[]}]

```

The benefits are...

- No file to write / read
- No process spawning
- Response is ready to use JS object (no parsing after spawning).
- Far simpler (IMO)

---

_[View the full topic](https://discourse.nodered.org/t/best-way-to-run-a-curl-command/29594)._
