# HTTP Post code conversion

**URL:** <https://discourse.nodered.org/t/http-post-code-conversion/80450>\
**Category:** General\
**Created:** [9 August 2023 21:57 UTC](https://discourse.nodered.org/t/http-post-code-conversion/80450 "2023-08-09T21:57:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DamianK](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DamianK](https://discourse.nodered.org/u/DamianK)\
**Post date:** [9 August 2023 21:57 UTC](https://discourse.nodered.org/t/http-post-code-conversion/80450/1 "2023-08-09T21:57:06Z")

</div>

In first words I would like to say Hi and inform that I am completely beginner in NodeRed, so far have done basics, but now stuck with something what might be a joke.

I would like to configure NodeRed to send SMS messages with notifications. SMS Gateway Provider (PL) share API that looks like this example:

```auto
curl -X GET -G \
'https://api2.smsXXXX.pl/sms' \
-d key=klucz \
-d password=haslo \
-d from=TEST \
-d to=600111222 \
-d msg=Wiadomosc

```

How should I convert this to be compatible with http post node?

---

<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:** [10 August 2023 13:48 UTC](https://discourse.nodered.org/t/http-post-code-conversion/80450/2 "2023-08-10T13:48:09Z")

</div>

`GET` means that the passed perameters will be URL parameters. The resulting full URL looks like:

```auto
https://api2.smsXXXX.pl/sms?key=klucz&password=haslo...

```

To use this in the request node, assuming you want to pass variable data into the parameter values, you can use Mustache style formatting on the URL property of the request node:

```auto
https://api2.smsXXXX.pl/sms?key={{{mykey}}}&password={{{mypassword}}}...

```

Where your inbound msg would be something like:

```auto
{
    mykey: 'klucz',
    mypassword: 'haslo',
    ...
}
```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [10 August 2023 16:01 UTC](https://discourse.nodered.org/t/http-post-code-conversion/80450/3 "2023-08-10T16:01:09Z")

</div>

Or set the url in the http request node to  
`https://api2.smsXXXX.pl/sms`.  
Select append msg.payload as query string  
Then sending a msg.payload like

```auto
{
    key: 'klucz',
    password: 'haslo'
}

```

The query sent would be  
`https://api2.smsXXXX.pl/sms?key=klucz&password=haslo`  
Adding other msg.payload properties and they will be appended to the query string also.

---

<div class="post-metadata">

**Author:** ![DamianK](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DamianK](https://discourse.nodered.org/u/DamianK)\
**Post date:** [10 August 2023 23:45 UTC](https://discourse.nodered.org/t/http-post-code-conversion/80450/4 "2023-08-10T23:45:55Z")

</div>

Thank you very much for all advices. Most important thing was how to convert that shell to url line. I have done as you suggested and it works!  
I even not planned to use variables, but with your suggestion it makes my “logic” more simple.

Thank you once again!

---

<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:** [24 August 2023 23:46 UTC](https://discourse.nodered.org/t/http-post-code-conversion/80450/5 "2023-08-24T23:46:25Z")

</div>

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