Queries the property data of a specified device.

Limits

  • You can query property data that was generated within the last 30 days.
    Note The data of a property is stored from the day when the property data was generated.
  • Each Alibaba Cloud account can run a maximum of 50 queries per second (QPS).
    Note 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 QueryDevicePropertyData

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

Asc Integer Yes 0

The sorting method of the property records in returned results. Valid values:

  • 0: in reverse chronological order
  • 1: in chronological order
EndTime Long Yes 1579249499000

The end of the time range to query. The value is a timestamp in milliseconds, such as 1579249499000.

Identifier String Yes temperature

The identifier of the property that you want to query.

If a device has multiple properties, you can call this operation multiple times to query these properties.

You can view the property identifier in the IoT Platform console. Go to the Define Feature tab of the Product Details page. You can also call the QueryThingModel operation and view the property identifier in the returned TSL data.

PageSize Integer Yes 10

The number of entries to return on each page. Maximum value: 50.

StartTime Long Yes 1579249499000

The beginning of the time range to query. The value is a timestamp in milliseconds, such as 1579249499000.

IotInstanceId String No iot-cn-0pp1n8t****

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 takes precedence.
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 airconditioning

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 property data returned if the call is successful.

List Array of PropertyInfo

The list of properties. Each element indicates a property.

PropertyInfo
Time String 1516541885630

The time when the property was modified.

Value String 2

The value of the property.

NextTime Long 1579249499000

The start time to query on the next page.

  • If the Asc parameter is set to 0, you can use this value for the EndTime parameter when you call this operation again to query the next page of property records.
  • If the Asc parameter is set to 1, you can use this value for the StartTime parameter when you call this operation again to query the next page of property records.
NextValid Boolean true

Indicates whether the next page exists.

  • true: The next page exists.
  • false: The next page does not exist.
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.

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

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=QueryDevicePropertyData
&ProductKey=a1BwAGV****
&DeviceName=device1
&Identifier=lightLevel
&StartTime=1516538300303
&EndTime=1516541900303
&PageSize=10
&Asc=1
&<Common request parameters>

Sample success responses

XML format

<QueryDevicePropertyDataResponse>
  <Data>
        <NextValid>false</NextValid>
        <NextTime>1579249151177</NextTime>
        <List>
              <PropertyInfo>
                    <Value>32.46</Value>
                    <Time>1579249151178</Time>
              </PropertyInfo>
        </List>
  </Data>
  <RequestId>45391E10-446B-4986-863E-1BA8CC44748F</RequestId>
  <Success>true</Success>
</QueryDevicePropertyDataResponse>

JSON format

{
  "Data": {
    "NextValid": false, 
    "NextTime": 1579249151177, 
    "List": {
      "PropertyInfo": [
        {
          "Value": "32.46", 
          "Time": 1579249151178
        }
      ]
    }
  }, 
  "RequestId": "45391E10-446B-4986-863E-1BA8CC44748F", 
  "Success": true
}

Error codes

For a list of error codes, visit the API Error Center.