Device Reporting a Message
Function
If a device cannot report data in the format defined in the product model, the device can use this API to report custom data to the platform, which then forwards the reported message to an application or other Huawei Cloud services for storage and processing.
For differences between message reporting and property reporting, see Message Communications Overview.
![](https://support.huaweicloud.com/intl/en-us/api-iothub/public_sys-resources/note_3.0-en-us.png)
It is not suitable to report data in JSON format for devices with low configuration and limited resources or with limits on bandwidth usage. In this case, devices can transparently transmit the original binary data to the platform, but a codec is required to convert binary data to JSON format. For details about how to develop codecs, see Developing a Codec.
Topic
Upstream: $oc/devices/{device_id}/sys/messages/up
![](https://support.huaweicloud.com/intl/en-us/api-iothub/public_sys-resources/note_3.0-en-us.png)
In addition to the preconfigured message reporting topic, devices can also use a topic not included in Topics. For example, /usr/xxx/data/up can be used.
Parameters
Parameter |
Mandatory or Optional |
Type |
Description |
---|---|---|---|
object_device_id |
Optional |
String |
Indicates the device to which the message is sent. If this parameter is not carried, the device specified in the topic is considered to be the intended device. |
name |
Optional |
String |
Indicates the message name. |
id |
Optional |
String |
Uniquely identifies a message. |
content |
Mandatory |
Object |
Indicates the message content. |
![](https://support.huaweicloud.com/intl/en-us/api-iothub/public_sys-resources/note_3.0-en-us.png)
IoTDA does not verify the format of the message reported by a device. The parameter description and example are for reference only. Devices can customize the data format as required.
Example
Topic: $oc/devices/{device_id}/sys/messages/up Data format: { "object_device_id": "{object_device_id}", "name": "name", "id": "id", "content": {"hello":"123"} }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot