Updated on 2023-02-16 GMT+08:00

Device Reporting Properties

Function

This API is used by a device to report property data in the format defined in the product model to the platform. For differences between property reporting and message reporting, see Message Communications Overview.

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/properties/report

Parameters

Parameter

Mandatory or Optional

Type

Description

services

Mandatory

List<ServiceProperty>

Indicates a list of device services. For details, see ServiceProperty structure.

ServiceProperty structure

Parameter

Mandatory or Optional

Type

Description

service_id

Mandatory

String

Identifies a service of the device.

properties

Mandatory

Object

Indicates the property list of the device service. Multiple property parameters can be defined in the product model associated with the device.

event_time

Optional

String

Indicates the UTC time when the device collects data. The value is in the format of yyyyMMdd'T'HHmmss'Z' or yyyy-MM-dd'T'HH:mm:ss.SSS'Z', for example, 20161219T114920Z or 2020-08-12T12:12:12.333Z.

If this parameter is not carried in the reported data or is in incorrect format, the time when the platform receives the data is used.

Example

Topic: $oc/devices/{device_id}/sys/properties/report  
Data format:
{
    "services": [{
            "service_id": "Temperature",
            "properties": {
                "value": 57,
                "value2": 60
            },
            "event_time": "20151212T121212Z"
        },
        {
            "service_id": "Battery",
            "properties": {
                "level": 80,
                "level2": 90
            },
            "event_time": "20151212T121212Z"
        }
    ]
}