云到设备的Azure IoT REST API [英] Cloud-to-device Azure IoT REST API
问题描述
我探索了使用Azure REST Apis将数据从设备发送到云的方法.它正在无缝运行,没有任何问题.我找不到有关使用"Azure IoT中心REST Apis"将云到设备消息发送到Arduino板的好文章.有人可以对此提出建议
I explored on sending data from Device to Cloud using Azure REST Apis. It is working seamlessly without any issues. I'm not finding good articles on sending Cloud-to-Device messages to Arduino board using "Azure IoT Hub REST Apis". Could some one provide suggestions on this
推荐答案
您也可以在Azure门户执行请求时发送请求.来自AZ Portal的所有C2D都通过此终结点发送 https://main.iothub .ext.azure.com/api/Service/SendMessage/,有效负载是一个看起来像这样的json:
You could also send the request as the azure portal does it. All C2D from AZ Portal are sent through this Endpoint https://main.iothub.ext.azure.com/api/Service/SendMessage/ and the payload is a json that look like this:
{
"hostName": "iothub-hostname",
"owner": "twinUpdate",
"key": "key for the iothub",
"deviceID": "your device on that hub",
"body": "{\"test\": \"This is a test over postman\"}",
"properties": "[]"
}
请记住,您需要添加带有有效Bearer令牌的授权标头.登录到AZ Portal时可以获取此信息.
Keep in mind that you need to add an Authorization Header with valid Bearer token. You can get this when you log in to AZ Portal.
这篇关于云到设备的Azure IoT REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!