Queries the property snapshot of a specified device.
Limits
Each Alibaba Cloud account can run a maximum of 20 queries per second (QPS).
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | QueryDevicePropertyStatus |
The operation that you want to perform. Set the value to QueryDevicePropertyStatus. |
IotInstanceId | String | No | iot_instc_pu****_c*-v64******** |
The ID of the instance. This parameter is not required for public instances. However, the parameter is required for the instances that you have purchased. |
IotId | String | No | Q7uOhVRdZRRlDnTLv****00100 |
The ID of the device. The device ID is issued by IoT Platform. Note If you specify this parameter, you do not need to specify the ProductKey or DeviceName parameter. The IotId parameter is a globally unique identifier (GUID), and corresponds to a combination
of the ProductKey and DeviceName parameters. If you specify the IotId parameter and a combination of the ProductKey and DeviceName parameters at the same time, the IotId parameter is used.
|
ProductKey | String | No | a1BwAGV**** |
The ProductKey of the product to which the device belongs. Note If you specify this parameter, you must also specify the DeviceName parameter.
|
DeviceName | String | No | light |
The name of the device. Note If you specify this parameter, you must also specify the ProductKey parameter.
|
In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information, see Common request parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | iot.system.SystemException |
The error code returned if the call fails. For more information, see Error codes. |
Data | Struct |
The data returned if the call is successful. For more information, see List. |
|
List | Array of PropertyStatusInfo |
The array of property information. The information about each property is indicated by the PropertyStatusInfo parameter. |
|
PropertyStatusInfo | |||
DataType | String | int |
The data type of the property. Valid values:
|
Identifier | String | Temperture |
The identifier of the property. |
Name | String | temperature |
The name of the property. |
Time | String | 1517553572362 |
The time when the property was modified, in milliseconds. |
Unit | String | °C |
The unit of the property value. |
Value | String | 25 |
The value of the property. |
ErrorMessage | String | A system exception occurred. |
The error message returned if the call fails. |
RequestId | String | E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565 |
The ID of the request. |
Success | Boolean | true |
Indicates whether the call was successful.
|
Examples
Sample requests
https://iot.cn-shanghai.aliyuncs.com/?Action=QueryDevicePropertyStatus
&ProductKey=a1rYuVF****
&DeviceName=device1
&<Common request parameters>
Sample success responses
XML
format
<QueryDevicePropertyStatusResponse>
<Data>
<List>
<PropertyStatusInfo>
<Name>Guan</Name>
<Value>48</Value>
<Time>1579249151178</Time>
<DataType>int</DataType>
<Identifier>Humidity</Identifier>
<Unit>%</Unit>
</PropertyStatusInfo>
<PropertyStatusInfo>
<Name>Temperature</Name>
<Value>32.46</Value>
<Time>1579249151178</Time>
<DataType>float</DataType>
<Identifier>Temperature</Identifier>
<Unit>°C</Unit>
</PropertyStatusInfo>
</List>
</Data>
<RequestId>84BAD25B-9879-4BA1-9213-F576C6558D77</RequestId>
<Success>true</Success>
</QueryDevicePropertyStatusResponse>
JSON
format
{
"Data": {
"List": {
"PropertyStatusInfo": [
{
"Name": "Humidity",
"Value": "48",
"Time": "1579249151178",
"DataType": "int",
"Identifier": "Humidity",
"Unit": "%"
},
{
"Name": "Temperature",
"Value": "32.46",
"Time": "1579249151178",
"DataType": "float",
"Identifier": "Temperature",
"Unit": "°C"
}
]
}
},
"RequestId": "84BAD25B-9879-4BA1-9213-F576C6558D77",
"Success": true
}
Error codes
For a list of error codes, visit the API Error Center.