# Rebuild curl command in Node-RED

**URL:** <https://discourse.nodered.org/t/rebuild-curl-command-in-node-red/30082>\
**Category:** General\
**Created:** [14 July 2020 19:28 UTC](https://discourse.nodered.org/t/rebuild-curl-command-in-node-red/30082 "2020-07-14T19:28:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tepebox](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tepebox/32/73617_2.png) [@tepebox](https://discourse.nodered.org/u/tepebox)\
**Post date:** [14 July 2020 19:28 UTC](https://discourse.nodered.org/t/rebuild-curl-command-in-node-red/30082/1 "2020-07-14T19:28:39Z")

</div>

Hi,

I guess a typical beginner's question: I have a curl command like this:

curl -d "message=TEST" -X POST [http://xxxx.xxx](http://xxxx.xxx)

How do I rebuild this in Node-RED? Looks that simple but I didn't manage to get it running, yet... Wanted to use a http node for that but how to configure it and what code do I need to set the payload correctly? At least this  
msg.headers={ 'Content-Type': 'application/x-www-form-urlencoded'};

msg.payload = 'message=test';

return msg;

doesn't work as well as

msg.headers={ 'Content-Type': 'application/x-www-form-urlencoded'};

msg.payload ={message:'test'};

return msg;

Thanks for any help...

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [14 July 2020 19:55 UTC](https://discourse.nodered.org/t/rebuild-curl-command-in-node-red/30082/2 "2020-07-14T19:55:08Z")

</div>

> [@tepebox](#):
>
> curl -d

The POST section in the CURL manual shows what is going on with the -d param

[https://curl.haxx.se/docs/manual.html](https://curl.haxx.se/docs/manual.html)

This translates into a POST request with the payload set to "message=TEST"

I don't think that any other headers would be required since you aren't providing them with curl.

---

<div class="post-metadata">

**Author:** ![tepebox](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tepebox/32/73617_2.png) [@tepebox](https://discourse.nodered.org/u/tepebox)\
**Post date:** [15 July 2020 18:55 UTC](https://discourse.nodered.org/t/rebuild-curl-command-in-node-red/30082/3 "2020-07-15T18:55:19Z")

</div>

Oh no, it really was a beginner's fault... I forgot to set the HTTP request to "POST"...

So this code works:

msg.headers={ 'Content-Type': 'application/x-www-form-urlencoded'};  
msg.payload ="message=Test";  
return msg;

Without the Content-Type setting it doesn't... For whatever reason...

If anyone is interested: this code was built to work with the "Text Nachricht" skill from Amazon... Just take this code into a function, use the HTTP Request Node, enter the URL you got from the skill, change Method to "POST" and you're done... Then you get a nice notification on all your Echo devices, the same as you get when you expect a delivery from Amazon...

THANKS

---

<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:** [13 September 2020 18:55 UTC](https://discourse.nodered.org/t/rebuild-curl-command-in-node-red/30082/4 "2020-09-13T18:55:28Z")

</div>

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