3

I am trying, in order to simulate a device, to send a message to an existing IoT-Hub following this procedure: https://www.codeproject.com/Articles/1113447/Azure-IOT-Hub-REST-API

I am able to successfully create my shared access signature using the Device Explorer.

In postman, I send a post request to: https://myHubName.azure-devices.net/devices/myDeviceId/messages/events?api-version=2016-02-03 (my real hub name isn't myHubName)

With the Authorization header with the shared access signature and with the content type header,

With this JSON: {deviceId: "myDeviceId", temperature: "80"}

But I have no response whatsoever from the endpoint (Timeout).

I feel like the server should at least respond with an unauthorized request. Am I missing something here?


EDIT: As discussed with Rita, I was missing the s in https when I was trying to send the request. The IoT-Hub now responds appropriately.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Moncefmd
  • 343
  • 1
  • 4
  • 9
  • Your code works for me. What's format of your shared access signature? – Rita Han May 11 '17 at 01:32
  • This is what the SAS looks like : SharedAccessSignature sr=HOSTNAME.azure-devices.net&sig=xxxxxxxxxxxxxxxxxxxxxxxxxh4T9R%2BGLVt9jFFc35Y%3D&se=1525xxxxxx&skn=iothubowner Also, just stating the obvious here, but the IoT-hub is active in azure. – Moncefmd May 11 '17 at 02:26
  • Can you monitor your device event data in the Device Explorer? Or can you [send event to your device using SDK](https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-csharp-csharp-getstarted#create-a-simulated-device-app)? – Rita Han May 11 '17 at 02:51
  • I am able to send and monitor the data that is produced from the SimulatedDevice example in the tutorial. All by using the same endpoint http://i.imgur.com/awZHgfH.png (it was at 0 before launching the SimulatedDevice program) – Moncefmd May 11 '17 at 03:03
  • What's the status code in postman after posting the request? – Rita Han May 11 '17 at 03:28
  • There is just no response from the server. I tried from three different internet connections without success. http://i.imgur.com/3ZPaqLi.png I feel like I am missing something obvious. – Moncefmd May 11 '17 at 03:37
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/143928/discussion-between-moncefmd-and-rita-han-msft). – Moncefmd May 11 '17 at 03:47

0 Answers0