0
votes

it seems like I have to get something really wrong on the Azure IoT Hub. I want to send a basic rest request to try testing it out.

I used postman for it and I already generated the SAS Token.

Postman

My URI is "https://xxxxx.azure-devices.net/devices/xxxxx/messages/api-version=2021-04-18". The first question would be where do I find my API-version? I saw that part in many other posts yet I donĀ“t know where to find the information. So I just decided to fill in the date where I created the instances.

My Second Question would be how should I classify the SAS Token in the header? Is Authentification the right parameter?

Thanks a lot for the help.

2

2 Answers

0
votes

You can find the answers to your question in this section of the docs.

  • Replace {api-version} with "2018-06-30" in the URI.
  • Set the Authorization header to a SAS token created as specified in the security tokens section of Using IoT Hub security tokens.
0
votes

How did you create the SAS Token? Ensure to set right policy when generating the SAS token as well as an expiry time in the future, see https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-security#security-tokens

Azure CLI IoT generated tokens have a default validity of 1 hour and validity can be extended by the --duration parameter.