Forum Discussion

mvrasack's avatar
mvrasack
Copper Contributor
Feb 01, 2023

Get Device to Cloud messages in IoT Hub using Rest API

Hello,

 

I'm currently trying to get the messages that I sent to my azure iot hub using rest api (postman), but without success, I always got 204 no content.

 

thats how i'm sending the message:

Type: POST

Url: https://{{iothub-north}}/devices/{{new-device}}/messages/events?api-version={{api-version}}

AuthorizationSharedAccessSignature sr={my sas-key}&sig={my-sig}se={my-se}.

 

Answer: 204 No Content.

 
thats how i'm trying to get the messages:

Type: GET

Url: https://{{iothub-north}}/devices/{{new-device}}/messages/deviceBound?api-version={{api-version}}

AuthorizationSharedAccessSignature sr={my sas-key}&sig={my-sig}se={my-se}.

 

Answer: 204 No Content.

 

I was searching for some documentation and found this: https://learn.microsoft.com/en-us/rest/api/iothub/device/receive-device-bound-notification

 

however, for what I understood, it only works for cloud to device messages, so can someone help me how can I get the messages that I sent from my device to my azure iot hub?

 

Obs: I've created one service bus to link in my azure iot hub just to be sure that I'm receiving the messages that I sent, and it's working, so probably the issue is something about the way I'm trying to GET these messages.

 

No RepliesBe the first to reply

Resources