0
votes

I am reading multiple documentation about Routing for Azure IoT hub:

But when you add in the section about "Routing query": level="storage" and you create the route, how to indicate in your curl request the route that you need to use.

Currently, the request that I use with curl is:

  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

How to add the information about the route level="storage"?

Many thanks in advance

Juan Antonio

2

2 Answers

5
votes

The routing examples in the Microsoft documentation all show examples using the SDK, you need to add an item to the appProperties section of the message. But if you need to use the HTTP endpoint, you can add appProperties by including a header prefixed with "iothub-app-". So the header you would need to add in your curl command is

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

Find the documentation here

Edit: I see Roman beat me by half a minute.

2
votes

Add the following header:

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