我正在阅读有关Azure IoT集线器路由的多个文档:
- https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-d2c
- https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/iot-hub/iot-hub-event-grid-routing-comparison.md
- https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/iot-hub/iot-hub-devguide-routing-query-syntax.md
- https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/iot-hub/tutorial-routing.md
但是,当您添加关于"路由查询"的部分:level="storage"并创建路由时,如何在curl请求中指示您需要使用的路由。
目前,我对curl使用的请求是:
curl --request POST
--url "https://${IOT_HUB}.azure-devices.net/devices/${DEVICE}/messages/events?api-version=2018-06-30"
--header "Accept: application/json"
--header "Content-Type: application/json;charset=utf-8"
--header "Authorization: ${SAS_TOKEN}"
--data "{ "field1" : "value", "field2" : "value" }"
--verbose
如何添加有关路线级别="存储"的信息?
提前感谢
Juan Antonio
Microsoft文档中的路由示例都显示了使用SDK的示例,您需要在消息的appProperties部分添加一个项。但是,如果您需要使用HTTP端点,您可以添加appProperties,方法是包含一个前缀为"iothub app-"的头。因此,您需要在curl命令中添加的头是
--header "iothub-app-level: storage"
在此处查找文档
编辑:我看到罗曼领先我半分钟。
添加以下标题:
--header "iothub-app-level: storage"