You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

硬件开发者咨询:设备向Azure IoT Hub发送反馈的端点问题

Azure IoT Hub HTTP Feedback for Hardware Devices

Hey there! As someone who’s worked with IoT Hub’s HTTP endpoints for hardware integrations, let’s walk through how to handle your feedback needs and address the ETag issue you’re facing.

Sending Feedback via HTTP Endpoint

Since you only have HTTP available, here’s the step-by-step process to send feedback for cloud-to-device (C2D) messages:

  • Capture critical headers when receiving C2D messages:
    When your device pulls a C2D message via the HTTP endpoint (https://{iot-hub-name}.azure-devices.net/devices/{device-id}/messages/devicebound?api-version=2020-09-30), IoT Hub returns key response headers you’ll need:

    • iothub-locktoken: This unique identifier for the message is mandatory for sending feedback.
    • ETag: A concurrency control value (not strictly required for basic feedback submission, but useful for validating message state if needed).
  • Construct the feedback request endpoint:
    Use this dedicated URL tied to the specific C2D message:

    https://{iot-hub-name}.azure-devices.net/devices/{device-id}/messages/devicebound/{lock-token}/feedback?api-version=2020-09-30
    

    Replace {lock-token} with the iothub-locktoken value you captured when receiving the message.

  • Configure the request details:

    • Method: POST
    • Request body (JSON format) to define feedback status:
      {
        "statusCode": 200,
        "description": "Message processed successfully"
      }
      
      Valid statusCode values map to feedback types:
      • 200: Message completed successfully
      • 400: Message rejected (invalid content, unsupported format, etc.)
      • 404: Message abandoned (couldn’t process, will be removed from the queue)
    • Authentication: Use the same SAS token or X.509 certificate your device uses to authenticate with IoT Hub.

Addressing the ETag Read Issue

If your hardware’s HTTP client can’t access the ETag response header, don’t worry—you don’t need ETag to send basic feedback. The iothub-locktoken is the only required value for submitting feedback.

If you do need ETag for concurrency checks later, double-check your HTTP client’s header parsing logic: some clients normalize header names (e.g., converting ETag to etag), so try accessing the lowercase version of the header key.

Default Endpoint for Feedback

There isn’t a single "default endpoint" for all feedback requests—each feedback submission is tied to a specific C2D message, hence the need to include the unique lock-token in the endpoint URL. This ensures IoT Hub maps your feedback to the correct message in its queue.

内容的提问来源于stack exchange,提问作者Alex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:39:46