如何在curl请求中指示您需要在Azure IoT中心中使用的路由?

问题描述 投票:0回答:1

我正在阅读有关Azure IoT中心路由的多个文档:

但是,当您添加有关“路由查询”的部分: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

如何添加有关路线级别=“存储”的信息?

非常感谢

胡安·安东尼奥

azure azure-devops azure-iot-hub
1个回答
0
投票

添加以下标题:

--header "iothub-app-level: storage" \

0
投票

Microsoft文档中的路由示例全部显示了使用SDK的示例,您需要在邮件的appProperties部分添加一个项目。但是,如果您需要使用HTTP端点,则可以通过添加以“ iothub-app-”为前缀的标头来添加appProperty。因此,您需要在curl命令中添加的标头是

--header "iothub-app-level: storage" \

查找文档here

编辑:我看到罗马打了我半分钟。

© www.soinside.com 2019 - 2024. All rights reserved.