I am trying to learn the Azure IoT hub, but I am unable to send data to my IoT hub using Postman. I did the following:
- Create Azure IoT hub
- Create a device using Azure Portal CLI
- Copied the text where it said "primary key" on the Device page
My request looks as follows:
POST https://myhub.azure-devices.net/devices/MyDevice/messages/events?api-version=2020-03-13
I have added the authorization header, which has the value: SharedAccessSignature=SharedAccessSignature sr=myhub.azure-devices.net%2Fdevices%2FMyDevice&sig=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Where the key is the copied text from the "primary key" field from the device page.
Content-type is set to application/json. But the body is currently empty.
I am getting the following response:
"Message": "ErrorCode:ServerError;InternalServerError",
Note: Hub and device name are not the same as stated here.