<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[HTTP POST to Azure IoT]]></title><description><![CDATA[<p dir="auto">Hey,</p>
<p dir="auto">Im relatively new to all this - and I've got a fair way but just can't replicate this POST command to get data into the Azure IoT platform.<br />
Ive successfully setup a Azure IOT Central App that can receive HTTP Post and then record the measurements<br />
See - <a href="https://github.com/Azure/iotc-device-bridge" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/Azure/iotc-device-bridge</a></p>
<p dir="auto">That is all setup and working and I can use PostMan to test with this<br />
<img src="/assets/uploads/files/1599182133433-985357a4-8094-4d27-b0f7-1e7e6754219c-image.png" alt="0_1599182132378_985357a4-8094-4d27-b0f7-1e7e6754219c-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">This works fine. I get the data into Azure IoT. It looks lovely.<br />
<img src="/assets/uploads/files/1599182930304-fd183531-7197-424f-a455-c324d261576a-image-resized.png" alt="0_1599182928983_fd183531-7197-424f-a455-c324d261576a-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I just want to replicate this simple HTTP Post with JSON data payload in a UIFlow. I can then use my m5Stickc to send the real data.</p>
<p dir="auto">Here is my attempt:<br />
<img src="/assets/uploads/files/1599182445191-93903347-5378-4580-978d-f0afe6a2db11-image-resized.png" alt="0_1599182443317_93903347-5378-4580-978d-f0afe6a2db11-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I have tried many variations of the 'data' payload   - sometimes I get 400 errors - sometimes I get responses to say the 'device' is not correctly specified - but most of my attempts I get no response back.</p>
<p dir="auto">What would be the best way to recreate the POST command in UIFlow?</p>
<p dir="auto">Im - close  - so thanks anybody that can help :)</p>
<p dir="auto">Russell</p>
]]></description><link>https://community.m5stack.com/topic/2267/http-post-to-azure-iot</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Mar 2026 23:48:55 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2267.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 Sep 2020 01:31:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HTTP POST to Azure IoT on Tue, 11 May 2021 03:07:51 GMT]]></title><description><![CDATA[<p dir="auto">Just wanted to thank you for posting this.  It helped me a great deal.</p>
]]></description><link>https://community.m5stack.com/post/13767</link><guid isPermaLink="true">https://community.m5stack.com/post/13767</guid><dc:creator><![CDATA[peteworthy]]></dc:creator><pubDate>Tue, 11 May 2021 03:07:51 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP POST to Azure IoT on Sat, 05 Sep 2020 12:42:27 GMT]]></title><description><![CDATA[<p dir="auto">I notice that http request function take some time to receive response (approx. 1-3 seconds) dependent of service you used. Requests function in python is rather blocking function, and rest of program should wait for end of this function work.</p>
]]></description><link>https://community.m5stack.com/post/9950</link><guid isPermaLink="true">https://community.m5stack.com/post/9950</guid><dc:creator><![CDATA[robalstona]]></dc:creator><pubDate>Sat, 05 Sep 2020 12:42:27 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP POST to Azure IoT on Sat, 05 Sep 2020 12:32:11 GMT]]></title><description><![CDATA[<p dir="auto">Looks good 👍🏻👍🏻</p>
]]></description><link>https://community.m5stack.com/post/9949</link><guid isPermaLink="true">https://community.m5stack.com/post/9949</guid><dc:creator><![CDATA[world101]]></dc:creator><pubDate>Sat, 05 Sep 2020 12:32:11 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP POST to Azure IoT on Sat, 05 Sep 2020 06:30:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/187">@world101</a> This also worked! Thanks.<br />
The 'Content-Type' was the key step it looks like.<br />
<img src="/assets/uploads/files/1599286951081-4da940a3-3ab8-41bb-90e4-cc0f91afd8fd-image.png" alt="0_1599286949721_4da940a3-3ab8-41bb-90e4-cc0f91afd8fd-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I had to put in those 'waits' else I randomly got 'Local variable referenced before assignment' errors during the POST step - which I can only guess at not having a Status code to set for status and then trying to Print that status. Its still not very reliable - It often hangs at that HTTP step and I have to reset.</p>
<p dir="auto">Anyway - progress! Here is the nice little graph of 'realworld' data from the m5stick in a dashboard in Azure IoT  - thanks for your help.<br />
<img src="/assets/uploads/files/1599287352207-e3922b1d-0018-4bad-9342-8c2444f1dd5a-image-resized.png" alt="0_1599287350659_e3922b1d-0018-4bad-9342-8c2444f1dd5a-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/9947</link><guid isPermaLink="true">https://community.m5stack.com/post/9947</guid><dc:creator><![CDATA[Russell]]></dc:creator><pubDate>Sat, 05 Sep 2020 06:30:33 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP POST to Azure IoT on Sat, 05 Sep 2020 06:19:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/2460">@robalstona</a> Yes - I did go down this route and it did work btw - Thanks</p>
]]></description><link>https://community.m5stack.com/post/9946</link><guid isPermaLink="true">https://community.m5stack.com/post/9946</guid><dc:creator><![CDATA[Russell]]></dc:creator><pubDate>Sat, 05 Sep 2020 06:19:34 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP POST to Azure IoT on Fri, 04 Sep 2020 15:32:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4349">@russell</a></p>
<p dir="auto">I think your DataMap and JSONdata payload looks good and is formatted correctly. Here is a slightly modified flow that has a few tweaks to set the content-type to JSON (since you are posting JSON data) and to remove the "get data" from the success/fail on HTTP request. I don't think you need that since you are doing HTTP POST and not GET. Plus you are already printing the JSONdata to the screen just before the HTTP Request.</p>
<p dir="auto"><img src="/assets/uploads/files/1599233540050-screen-shot-2020-09-04-at-11.22.59-am-resized.png" alt="0_1599233508721_Screen Shot 2020-09-04 at 11.22.59 AM.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Since I'm not an Azure IoT user, I used an Adafruit IO Webhook to verify the flow operates correctly to get data to the cloud.  I get a status code 200 (HTTP OK) with the flow above. I also had to add a header with my AIO secret key, so you might need to do the same with the Azure "code" secret key. Please verify that with the Azure IoT API documentation. Give it a try and see how it goes. If it gives something other than HTTP 200 for the status, let us know what the error code is so we can troubleshoot further.</p>
<p dir="auto">Also, I have noticed before if I try to do too much logic in the success/fail sections of the HTTP Request block, strange things can happen. So I like to keep it simple and just capture the status code to a variable and then print it after the HTTP Request has finished.</p>
]]></description><link>https://community.m5stack.com/post/9944</link><guid isPermaLink="true">https://community.m5stack.com/post/9944</guid><dc:creator><![CDATA[world101]]></dc:creator><pubDate>Fri, 04 Sep 2020 15:32:36 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP POST to Azure IoT on Fri, 04 Sep 2020 10:51:11 GMT]]></title><description><![CDATA[<p dir="auto">You could try a create manual string in json format something like that (incomplete example)</p>
<p dir="auto"><img src="/assets/uploads/files/1599216421787-screenshot_20200904-124349-resized.png" alt="0_1599216414009_Screenshot_20200904-124349.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">and send this rawdata variable, maybe this work, ewentually try change content type header from text to json. or send your DataMap without dump json block.</p>
]]></description><link>https://community.m5stack.com/post/9941</link><guid isPermaLink="true">https://community.m5stack.com/post/9941</guid><dc:creator><![CDATA[robalstona]]></dc:creator><pubDate>Fri, 04 Sep 2020 10:51:11 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP POST to Azure IoT on Fri, 04 Sep 2020 04:55:58 GMT]]></title><description><![CDATA[<p dir="auto">In simple terms without all the story, how do you do a HTML Post with this data?</p>
<p dir="auto">{<br />
"device": {<br />
"deviceId": "postmantest"<br />
},<br />
"measurements": {<br />
"Temp": 29.31,<br />
"Pressure": 44,<br />
"humidity": 8.3,<br />
"ledColor": "red"<br />
}<br />
}</p>
<p dir="auto">For those who do code - I dont - postman says the code would be..</p>
<p dir="auto">curl --location --request POST 'https://[sitecode].azurewebsites.net/api/IoTCIntegration?code=[key]' <br />
--header 'Content-Type: text/plain' <br />
--data-raw '{<br />
"device": {<br />
"deviceId": "postmantest"<br />
},<br />
"measurements": {<br />
"Temp": 29.31,<br />
"Pressure": 44,<br />
"humidity": 8.3,<br />
"ledColor": "red"<br />
}<br />
}'</p>
]]></description><link>https://community.m5stack.com/post/9936</link><guid isPermaLink="true">https://community.m5stack.com/post/9936</guid><dc:creator><![CDATA[Russell]]></dc:creator><pubDate>Fri, 04 Sep 2020 04:55:58 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP POST to Azure IoT on Fri, 04 Sep 2020 03:00:10 GMT]]></title><description><![CDATA[<p dir="auto">not idea.  maybe you could check the request header does same to the postman test sample</p>
]]></description><link>https://community.m5stack.com/post/9934</link><guid isPermaLink="true">https://community.m5stack.com/post/9934</guid><dc:creator><![CDATA[m5stack]]></dc:creator><pubDate>Fri, 04 Sep 2020 03:00:10 GMT</pubDate></item></channel></rss>