0
votes

Asking this question behalf of a hardware developer.

I'm trying to send feedback for a message to IOT Hub, my problem is only http endpoints are working for me, no other protocols are supported, also not able to read the header to get the etag sending by the IOT Hub in cloud-to-device message.

So how can i sent feedback to IOT Hub, is there any default endpoint is there?

2

2 Answers

0
votes

Uh.. i don't know if the Message Id is the same as the ETag (in the hope that you have the former). Pretty sure it's not, in which case you'll need the ETag.

Here's something i wrote in the past for an Arduino Mega

In short, for complete:

DELETE /devices/{device_id}/messages/devicebound/{etag}?api-version=2016-02-03

A cleaner implementation in this repo, also showing reject and abandon.

0
votes

Actually, there is no public endpoint for customer send feedback for C2D message. We can only change the state of message and Azure IoT hub will send the feedback to the feedback endpoint which used for the service-side to receive the feedback based on the state of message. Here is a helpful document to understand Message feedback.

I'm trying to send feedback for a message to IOT Hub, my problem is only http endpoints are working for me, no other protocols are supported,

If you use azure iot sdk, there is an API: deviceClient.CompleteAsync() to notifies IoT Hub that the message has been successfully processed. The message can be safely removed from the device queue.

As well as:

AbandonAsync(): to notifies IoT Hub puts a received message back onto the device queue

RejectAsync(): to notifies IoT Hub deletes a received message from the device queue and indicates to the server that the message could not be processed.

You can reference DeviceClientHttpSample.

also not able to read the header to get the etag sending by the IOT Hub in cloud-to-device message.

REST api can read etag.

Receive a C2D message(Receive Device Bound Notification):

GET https://<fully-qualified IoT hub domain name>/devices/device1/messages/deviceBound?api-version=2016-11-14

From response header you can get etag:

enter image description here

Send a feedback using etag retrieved above(Complete Device Bound Notification):

enter image description here