我如何使用 azure Device Identities REST?

How i can use azure Device Identities REST?

我想使用 azure Device Identities REST API 创建设备身份:https://msdn.microsoft.com/en-us/library/azure/mt548489.aspx 但我不知道在 header 请求中设置的语法? 关键是什么,如何产生价值? 这是参数:

谢谢

请看这里:https://azure.microsoft.com/documentation/articles/iot-hub-sas-tokens/#using-security-tokens-from-service-components

本文介绍了如何生成所需的安全令牌 - 特别是 "Using security tokens from service components".

部分

正如@DominicBetts所说,您可以参考引用的document自行生成SAS token。

作为参考,没有 Java 的现有示例代码,但我认为您可以尝试参考 Python 的官方示例以了解如何使用设备标识 REST API,请在 https://azure.microsoft.com/en-us/documentation/samples/iot-hub-python-get-started/ 查看示例并下载示例 zip 文件以查看脚本 service/deviceManager.py

同时,您也可以尝试直接阅读Java的IoTHub SDK源码。要生成 SAS 令牌,请参阅 https://github.com/Azure/azure-iot-sdks/blob/master/java/service/iothub-service-sdk/src/main/java/com/microsoft/azure/iot/service/auth/IotHubServiceSasToken.java.

处的代码