Updated on 2023-10-18 GMT+08:00

Message Reporting Usage

Description

Figure 1 Process of device message reporting
  1. Product and device creation: For details, see Creating a Product and Registering an Individual Device.
  2. Device authentication: The platform checks whether the device has the access permission.
  3. Device message reporting: Devices report messages through protocols such as MQTT and HTTP.

    Use different APIs for different protocols.

    MQTT: Use the message reporting APIs for MQTT devices. The following is an example of MQTT device message reporting.
    Topic: $oc/devices/{device_id}/sys/messages/up
    Data format example:
    {
        "content": {"hello":"123"} 
    }
    HTTPS: Use the message reporting APIs for HTTP devices. To obtain access_token for HTTP devices, see Authenticating a Device. The following is an example of HTTPS device message reporting.
    POST https://{endpoint}/v5/devices/{device_id}/sys/messages/up 
    Content-Type: application/json
    access_token: d144a524-1997-4b99-94bf-f27128da8a34
    {
        "name": "name",
        "id": "id",
        "content": "messageUp"
    }
    1. For details about devices using different protocols, see MQTT Device Reporting a Message and HTTP Device Reporting a Message.

  4. Data forwarding: With the data forwarding function, data can be forwarded to applications or other Huawei Cloud services for storage and processing.