Queries the desired values of properties of a device.

Usage notes

  • The desired values of read-only properties cannot be queried.
  • You can query the desired values of up to 10 properties in a single call.

QPS limits

You can call this API operation up to 50 times per second per account.

Note The RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes QueryDeviceDesiredProperty

The operation that you want to perform. Set the value to QueryDeviceDesiredProperty.

IotInstanceId String No iot_instc_pu****_c*-v64********

The ID of the instance. You can view the ID of the instance on the Overview page in the IoT Platform console.

Important
  • If your instance has an ID, you must specify the ID for this parameter. Otherwise, the call fails.
  • If no Overview page or ID is generated for your instance, you do not need configure this parameter.

For more information, see Overview.

ProductKey String No a1BwAGV****

The ProductKey of the product to which the device belongs.

Note If you specify a value for this parameter, you must configure the DeviceName parameter.
DeviceName String No light

The DeviceName of the device.

Note If you specify a value for this parameter, you must configure the ProductKey parameter.
Identifier.N RepeatList No Temperature

The identifiers of the properties that you want to query.

To view the property identifiers, go to the Define Feature tab of the Product Details page in the IoT Platform console.

  • You can specify up to 10 property identifiers in a single call.
  • Each property identifier must be unique.
  • If you do not configure this parameter, the desired values of all properties are returned.
IotId String No Q7uOhVRdZRRlDnTLv****00100

The ID of the device. The ID is a unique identifier that is issued by IoT Platform to the device.

Note If you specify a value for this parameter, you do not need to configure the ProductKey or DeviceName parameter. The IotId parameter specifies a GUID for the device. The value of the IotId parameter is equivalent to a combination of the values of the ProductKey and DeviceName parameters. If you specify values for the IotId, ProductKey, and DeviceName parameters, the value of the IotId parameter takes precedence.
FunctionBlockId String No BatteryModule

The identifier of the custom TSL module. Each identifier is unique in a product.

If you do not configure this parameter, the system queries the data of the default module.

In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this operation. For more information about common request parameters, see Common 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 in the List parameter if the call is successful.

List Array of DesiredPropertyInfo

The desired property information returned in the DesiredPropertyInfo parameter.

DesiredPropertyInfo
DataType String int

The data type of the property.

Identifier String Temperature

The identifier of the property.

Name String airconditioning

The name of the property.

Time String 1579335899000

The time when the desired value of the property was last modified. Unit: milliseconds.

Unit String °C

The unit of the property.

Value String 34

The desired value of the property.

Note If you call the ClearDeviceDesiredProperty operation to delete the desired value of the property, the Value parameter is not returned.
Version Long 1

The version of the desired value.

ErrorMessage String A system exception occurred.

The error message that is 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.

  • true: The call was successful.
  • false: The call failed.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=QueryDeviceDesiredProperty
&IotId=SR8FiTu1R9tlUR2****0010300
&Identifier.1=Weight
&Identifier.2=Circle
&<Common request parameters>

Sample success responses

XML format

<QueryDeviceDesiredPropertyResponse>
  <Data>
        <List>
              <DesiredPropertyInfo>
                    <Name>Temperature</Name>
                    <Value>35</Value>
                    <Time>1581778567154</Time>
                    <DataType>float</DataType>
                    <Version>1</Version>
                    <Identifier>Temperature</Identifier>
                    <Unit>°C</Unit>
              </DesiredPropertyInfo>
        </List>
  </Data>
  <RequestId>F0B1F7C8-A799-44C3-BDF8-1B8F9E91E675</RequestId>
  <Success>true</Success>
</QueryDeviceDesiredPropertyResponse>

JSON format

{
  "Data": {
    "List": {
      "DesiredPropertyInfo": [
        {
          "Name": "Temperature", 
          "Value": "35", 
          "Time": "1581778567154", 
          "DataType": "float", 
          "Version": 1, 
          "Identifier": "Temperature", 
          "Unit": "°C"
        }
      ]
    }
  }, 
  "RequestId": "F0B1F7C8-A799-44C3-BDF8-1B8F9E91E675", 
  "Success": true
}