# \[Solved\] Can you help me make a POST to Shelly using x-www-form-urlencoded calls?

**URL:** <https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678>\
**Category:** Web API's\
**Tags:** webapi\
**Created:** [May 23, 2022, 1:28pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678 "2022-05-23T13:28:38Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 23, 2022, 1:28pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/1 "2022-05-23T13:28:38Z")

</div>

I use web api for communication with device shelly

> **[Communication | Shelly Technical Documentation](https://shelly-api-docs.shelly.cloud/cloud-control-api/communication/)**
>
> For calling a device you need the device\_id for that device. It is available

The get work fine

curl -X POST https://\<server\_uri\>/device/status -d “id=\<device\_id\>&auth\_key=\<auth\_key\>”

![get](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/0/0059b04f2c07a6961fb7678b2c08715a6edd8501.png)

But the set Controlling device not work

curl -X POST https://\<server\_uri\>/device/relay/control -d “channel=&turn=\<on|off\>&id=\<device\_id\>&auth\_key=\<auth\_key\>”

The response is: {“isok”:false,“errors”:{“wrong\_channel”:“Could not control this relay channel!”}}  
error is: 400

![post2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/a/5ad2b18a8d25f68ece93f6b22b69c5cf1f27a510.png)

On this support

> **[Control Plug S through Cloud API - Offizielles Shelly Support Forum](https://www.shelly-support.eu/forum/index.php?thread%2F10903-control-plug-s-through-cloud-api%2F)**
>
> Hi,I just bought a Plug S and want to control it through the cloud API. I followed this guide:https://shelly.cloud/documents…elly\_cloud\_api\_access.pdfAnd I can read the device status successfully through /device/status. But when I try to turn the...

explains to make an https POST request and not GET , In the code I selected post but I can’t solve the problem

I have also tried sending the message as a body or as a header, but in all my tests the response is an invalid authorization!

The get worked after many trials and only worked using QueryParameters

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 23, 2022, 2:04pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/2 "2022-05-23T14:04:57Z")

</div>

> [@ferrarofcfei](#):
>
> curl -X POST https://\<server\_uri\>/device/relay/control -d “channel=&turn=\<on|off\>&id=\<device\_id\>&auth\_key=\<auth\_key\>”

Does that _curl_ command work, for example in Terminal or Postman? If not, do you get the same error?

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 23, 2022, 2:09pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/3 "2022-05-23T14:09:26Z")

</div>

yes

 ![cmd](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/5/f54039cbafabcbed1883763efc7255abebb48a6f.png)

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [May 23, 2022, 2:19pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/4 "2022-05-23T14:19:03Z")

</div>

according to the docs, I’d try something like this

![Screen Shot 2022-05-23 at 10.15.26 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/8/689d1278b4e8eb859cb1d3f01bcee0bb386d8354.png)

> **[shelly\_cloud\_api\_access.pdf](https://shelly.cloud/documents/developers/shelly_cloud_api_access.pdf)**

check out page 10 there.

You’ll need to set your Content-type header, and pass the data in as a string in the body of the POST

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 23, 2022, 2:31pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/5 "2022-05-23T14:31:03Z")

</div>

Thank you very much for your support!  
I really tried them all, even with the get, if I don’t use “QueryParameters” it denies me permission.  
here is the proof as you suggested and his response

 ![nuovo](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/3/3339720611db53ea97becea3c25f4b8235ff284b.png)  
 ![risposta](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/e/0e8e9c1161c22cbb8d6fb6d8c7d19c19d4777b0a.png)

can you give me a hint to see how thunkable web-api translates the code I wrote?  
I would like to find a way to know if it really ships  
curl -X POST https://\<server\_uri\>/device/relay/control -d “channel=&turn=\<on|off\>&id=\<device\_id\>&auth\_key=\<auth\_key\>”  
as I asked it to do

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 23, 2022, 2:36pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/6 "2022-05-23T14:36:10Z")

</div>

![header](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/6/362ff168478b5e5193360515b54fe9a631614478.png)  
If I use header instead this happens

 ![headercode](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/c/7c058efc6bb75f5f402c6c718a7cde58f1af3c9b.png)

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 23, 2022, 2:43pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/7 "2022-05-23T14:43:54Z")

</div>

I also found a post where it said to do this but commqua it doesn’t work and gives the same message as above

 ![header3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/7/77a40be1d6cef602c700d3936957afd059ac0000.png)

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 23, 2022, 2:55pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/8 "2022-05-23T14:55:34Z")

</div>

Without this call my app is meaningless!  
If anyone can help me I would be very grateful.  
To try it would just need to install his shelly cloud app, that way you can have your “auth\_key” then I share a device with you just by stating your email with which you registered in the app and so you also have in id device to try it.  
Would anybody do that?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 23, 2022, 7:00pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/9 "2022-05-23T19:00:24Z")

</div>

You are not putting commands in the correct order, this is why you are not getting results.

You need to set it this way:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/7/d77effb392a040da3809a2ca0ef29f3b74be09ea.png)

Replace `server_uri`, `device_id`, `auth_key` with the relevant values.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [May 23, 2022, 7:47pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/10 "2022-05-23T19:47:16Z")

</div>

⬆⬆⬆

Looks spot on! Please try out @muneer’s advice @ferrarofcfei and let us know how you get along! 🙂

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 23, 2022, 8:09pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/11 "2022-05-23T20:09:52Z")

</div>

Thank you, I did several tests following your advice, but I’ll tell you what I found out.

1. the get with /device/status was already working for me using the queryParameter, in this case I need a set using a POST and thus doing a /device/relay/control
2. I tried from promt and the curl command and even mixing the parameters the device always responds, so it seems that the order is not important
3. I still tried your sequence (and mine which i put the picture below) and it doesn’t work because it gives the error “header property …”  
4 I tried removing the body altogether and it gives the same error “header property…” so time there is a problem in the headers  
 ![Schermata 2022-05-23 alle 22.07.24](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/4/649ceb710b11b5632fbc6cc8979c5d928b46c091.png)  
 ![Schermata 2022-05-23 alle 22.06.20](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/3/9324622486c25aafb511289dc8291d7a16b91f9e.png)  
 ![Schermata 2022-05-23 alle 22.03.58](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/4/b42877d92b3f8c59a21072ffa5642d4ff373bd16.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 23, 2022, 8:20pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/12 "2022-05-23T20:20:41Z")

</div>

Try removing this block  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/4/54f138e53fe21aa7ba504792bbc2ff771f65361a.png)

And just use the rest of the blocks.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/f/df1f56879a5b5148d062731bb7a23d658bacf390.png)

This is extracted from this  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/8/b837a17eb74dd980bcbaa600e58ad2afc2705a78.png)

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 23, 2022, 9:07pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/13 "2022-05-23T21:07:44Z")

</div>

nothing

 ![Schermata 2022-05-23 alle 23.06.26](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/9/19db8c3d313657dc30aff828ea29b4edf9922962.png)  
 ![Schermata 2022-05-23 alle 23.06.11](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/8/e833c453d05404fbe7fcab0976e2e88437624419.png)

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 23, 2022, 9:10pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/14 "2022-05-23T21:10:36Z")

</div>

@muneer if you install the shelly cloud app, that way you can have your “auth\_key” after I share a device with you and you have an id device to try it.  
would you do me this favor.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 23, 2022, 9:52pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/15 "2022-05-23T21:52:17Z")

</div>

> [@ferrarofcfei](#):
>
> would you do me this favor.

Sure.  
I’ll do that tomorrow. It’s about 1am in the morning my time.

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 24, 2022, 6:59am UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/16 "2022-05-24T06:59:06Z")

</div>

@muneer thank you very much, please allow me to unblock the app that stops on this issue. When you install the “Shelly Cloud” app please send me your email to share my device with you.

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 24, 2022, 12:49pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/17 "2022-05-24T12:49:06Z")

</div>

hey guys i just can’t find the solution ☹

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 24, 2022, 1:56pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/18 "2022-05-24T13:56:23Z")

</div>

I registered in the cloud. Please send me your device ID in a PM.

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 24, 2022, 2:12pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/19 "2022-05-24T14:12:52Z")

</div>

send me your email in PM to share my device and have the ability to manage it

---

<div class="post-metadata">

**Author:** ![ferrarofcfei](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ferrarofcfei/32/133499_2.png) [@ferrarofcfei](https://community.thunkable.com/u/ferrarofcfei)\
**Post date:** [May 24, 2022, 5:13pm UTC](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678/20 "2022-05-24T17:13:57Z")

</div>

is there any way to know how to format the web-api command i wrote?

[Next page](https://community.thunkable.com/t/solved-can-you-help-me-make-a-post-to-shelly-using-x-www-form-urlencoded-calls/1890678.md?page=2)
