Call this operation to query the property records 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 the property data was generated. Data that was generated more than 30 days ago is no longer stored.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to run. Set the value to QueryDevicePropertyData.
IotId String No

Device ID, which is the unique identifier of a device.

Note If you use this parameter, ProductKey and DeviceName are not required. IotId is the globally unique identifier (GUID) of a device, and corresponds to the combination of ProductKey and DeviceName. If you specify both IotId and the combination of ProductKeyand DeviceName, the system follows IotId.
ProductKey String No

The product key of the device whose property records you want to query.

Note If you use this parameter, DeviceName is required.
DeviceName String No

The device name.

Note If you use this parameter, ProductKey is required.
Identifier String Yes

The identifier of the property that you want to query.

You can view the Identifier values of properties in the TSL of the product on the Define Feature page in the IoT Platform console. You only can query the records of one property in a request.

StartTime Long Yes The start time of property records that you want to query. The value is a 13 digit timestamp.
EndTime Long Yes The end time of property records that you want to query. The value is a 13 digit timestamp.
PageSize Integer Yes The number of records per page in the response. The maximum limit is 50.
Asc Integer Yes

The sorting order of the property records in returned results. Value options:

  • 0: In reverse chronological order.

  • 1: In chronological order.

Common request parameters - Yes See Common parameters.

Response parameters

Parameter Type Description
RequestId String The globally unique ID generated by Alibaba Cloud for the request.
Success Boolean Indicates whether the call is successful. A value of true indicates that the call is successful. A value of false indicates that the call has failed.
ErrorMessage String The error message returned when the call fails.
Code String The error code returned when the call fails. For more information about error codes, see Error codes.
Data Data The device property record returned when the call is successful. For more information, see the following table.
Table 1. Data
Parameter Type Description
List List<PropertyList> The collection of properties. Each element represents a property. See PropertyInfo for element descriptions.
NextValid Boolean Indicates whether there is a next page of records. A value of true indicates available, and a value of false indicates unavailable.
NextTime Long The start time of property records on the next page.
Table 2. PropertyInfo
Parameter Type Description
Value String The property value.
Time Long The time when the property was modified.

Examples

Request example

https://iot.cn-shanghai.aliyuncs.com/?Action=QueryDevicePropertyData
&IotId=SR8FiTu1R9tlUR2V1bmi0010*****
&ProductKey=al*********
&DeviceName=device1
&Identifier=lightLevel
&StartTime=1516538300303L
&EndTime=1516541900303L
&PageSize=10
&Asc=1
&<Public Request Parameters>

Response parameter

  • JSON format

    {
      "RequestId":"57b144cf-09fc-4916-a272-a62902d5b207",
      "Success": true,
      "Data": {
        "NextValid": true,
        "NextTime": 1516541821599,
        "List": {
          "PropertyInfo": [
            {
              "Value": "32",
              "Time": 1516541894876
            },
            {
              "Value": "2",
              "Time": 1516541885630
            },
            {
              "Value": "95",
              "Time": 1516541875947
            },
            {
              "Value": "14",
              "Time": 1516541830905
            },
            {
              "Value": "78",
              "Time": 1516541821600
            }
          ]
        }
      }
    }
  • XML format

    <? xml version='1.0' encoding='utf-8'? >
    <QueryDevicePropertyDataResponse>
        <RequestId>57b144cf-09fc-4916-a272-a62902d5b207</RequestId>
        <Success>true</Success>
        <Data>
            <NextValid>true</NextValid>
            <NextTime>1516541821599</NextTime>
            <List>
                <PropertyInfo>
                    <Value>32</Value>
                    <Time>1516541894876</Time>
                </PropertyInfo>
                <PropertyInfo>
                    <Value>2</Value>
                    <Time>1516541885630</Time>
                </PropertyInfo>
                <PropertyInfo>
                    <Value>95</Value>
                    <Time>1516541875947</Time>
                </PropertyInfo>
                <PropertyInfo>
                    <Value>14</Value>
                    <Time>1516541830905</Time>
                </PropertyInfo>
                <PropertyInfo>
                    <Value>78</Value>
                    <Time>1516541821600</Time>
                </PropertyInfo>
            </List>
        </Data>
    </QueryDevicePropertyDataResponse>