接收从Azure到esp8266的云到设备消息

时间:2016-12-14 22:59:44

标签: azure iot arduino-esp8266

使用此项目here我能够获得esp8266向Azure Iot集线器发送消息,我可以使用PowerBI阅读它们。但是,我希望能够使用设备资源管理器Twin向设备发送消息。

我想,因为esp正在使用HTTP POST请求向Iot中心发送消息,所以我应该能够使用HTTP GET请求来读取使用正确端点时发送给设备的消息,概述{{ 3}}

这是正确的,还是我错过了什么?这样做似乎只会导致错误。如果这是正确的方法,那么正确的GET请求的格式是什么。

1 个答案:

答案 0 :(得分:0)

通过REST API从Azure IoT中心接收云到设备消息,您可以使用GET method

与POST方法不同,您需要在Request URI部分使用“devicebound”而不是“events”。

关于公共参数和标题,只需要授权标题,它与POST请求中的标题相同。

GET请求中不需要正文。

所以,你的GET请求看起来像这样:

BOOT FAILED
   ===========

   Error description:    "Found lock file at ~s.\n            Either previous upgrade is in progress or has failed.\n            Database
   backup path: ~s"

   Log files (may contain more information):   
   /var/log/rabbitmq/rabbit@vm-10-111-29-211.log   
   /var/log/rabbitmq/rabbit@vm-10-111-29-211-sasl.log

   Stack trace:    [{rabbit_upgrade,ensure_backup_taken,
       ["/var/lib/rabbitmq/mnesia/rabbit@vm-10-111-29-211/schema_upgrade_lock", "/var/lib/rabbitmq/mnesia/rabbit@vm-10-111-29-211-upgrade-backup"],
       [{file,"src/rabbit_upgrade.erl"},{line,101}]},
       {rabbit_upgrade,maybe_upgrade_mnesia,0,
                       [{file,"src/rabbit_upgrade.erl"},{line,144}]},
       {rabbit,'-boot/0-fun-0-',0,[{file,"src/rabbit.erl"},{line,271}]},
       {rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,403}]},
       {init,start_it,1,[]},
       {init,start_em,1,[]}]

   {"init terminating in do_boot","Found lock file at ~s.\n           
   Either previous upgrade is in progress or has failed.\n           
   Database backup path: ~s"}

   Crash dump was written to: erl_crash.dump init terminating in do_boot
   (Found lock file at ~s.
               Either previous upgrade is in progress or has failed.
               Database backup path: ~s)