0
votes

There is a doc at Reference - IoT Hub endpoints that says that device endpoints: These endpoints are exposed using MQTT v3.1.1, HTTPS 1.1, and AMQP 1.0 protocols. AMQP and MQTT are also available over WebSockets on port 443. I can't find any documentation on how to access the twin document over HTTP. The samples on the various SDKs include only on MQTT and AMQP. I also looked in the IoT Hub REST and found only references to D2C. There is however in the C SDK a sample that one could supposedly get the twin document over HTTP, however when attempting to do that, one gets the following error:

v42$ ./iothub_client_device_twin_and_methods_sample
Error: Time:Wed Jun 17 13:35:02 2020 File:/Users/lucarv/OneDrive - Microsoft/source/devices/sdk/c/iothub_client/src/iothubtransporthttp.c Func:IoTHubTransportHttp_Subscribe_DeviceTwin Line:1189 IoTHubTransportHttp_Subscribe_DeviceTwin Not supported

I assume that Device Twins over HTTP is NOT supported. If that is true, would you kindly update your documentation? If it is indeed supported, could you please send me pointers to how this could be implemented?

1
Microsoft confirms that it's not available over HTTPS and will change the documentation.Matthijs van der Veer
Changes have been made to the documentation, can you check if they meet your expectations? And if my answer is correct, could you mark it as accepted? Thanks!Matthijs van der Veer

1 Answers

0
votes

You're correct, a device can't retrieve its Device Twin over HTTP. It is supported over MQTT and AMQP. I've added an issue on the documentation here

The only way to retrieve a Device Twin over HTTP is through the service endpoint of the IoT Hub. So while possible, it's not something you would do on the device side.