Platform Querying Device Properties
Function
This API is used by the platform to query property information from a device. For details of the API, see Querying Device Properties. When a device receives a property query request, the device needs to return its property data to the platform. Otherwise, the request is considered to have timed out by the platform.
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, You can use codecs to convert binary data into JSON data defined by the platform. For details, see Developing a Codec.
Topic
Downstream: $oc/devices/{device_id}/sys/properties/get/request_id={request_id}
Upstream: $oc/devices/{device_id}/sys/properties/get/response/request_id={request_id}
- {request_id} is used to uniquely identify a request. If a device receives a downstream request with a topic carrying a request ID, the request ID must be included in the topic of the upstream response returned by the device.
- When an application calls the API for Querying Device Properties, the platform generates a unique ID to identify the request. This ID is carried in request_id in the downstream topic of the platform-side device property query.
- The device cannot detect the request_id in advance. When a device subscribes to a topic that ends with request_id={request_id}, the number sign (#) can be used to replace request_id={request_id}, for example, $oc/devices/{device_id}/sys/properties/get/#.
Downstream Request Parameters
| Parameter | Mandatory/Optional | Type | Description |
|---|---|---|---|
| object_device_id | Optional | String | Explanation:
|
| service_id | Optional | String | Explanation: Device service ID, which is defined in the Product Model Definition associated with the device. |
Upstream Response Parameters
| Parameter | Mandatory/Optional | Type | Description |
|---|---|---|---|
| services | Optional | List<ServiceProperty> | Explanation: Indicates a list of device services. |
ServiceProperty structure
| Parameter | Mandatory/Optional | Type | Description |
|---|---|---|---|
| service_id | Mandatory | String | Explanation: Device service ID, which is defined in the Product Model Definition associated with the device. |
| properties | Mandatory | Object | Explanation: 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 | Explanation: Indicates the UTC time when the device collects data. The format is yyyyMMdd'T'HHmmss'Z', for example, 20161219T114920Z. If this parameter is not carried in the reported data or is in an incorrect format, the time when IoTDA receives the data is used. |
Example Downstream Request
Topic: $oc/devices/{device_id}/sys/properties/get/request_id={request_id}
Data format:
{
"object_device_id": "{object_device_id}",
"service_id": "Temperature"
} What is your overall rating for this page?
Thank 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