All Products
Search
Document Center

IoT Platform:QueryDeviceOriginalPropertyData

Last Updated:Apr 19, 2024

Queries the original property records that are submitted by a specified device. These records include the records of properties that passed and failed the verification of a specified Thing Specification Language (TSL) model.

Usage notes

You can query only the property records that are generated within the previous 30 days.

Note

The data of a property is stored from the day when the data is generated.

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 for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

QueryDeviceOriginalPropertyData

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

Asc

Integer

Yes

0

The order in which you want to sort the returned property records. Valid values:

  • 0: descending.

  • 1: ascending.

Note

The start time must be earlier than the end time. The system sorts the returned records based on the specified order.

EndTime

Long

Yes

1579249499000

The end of the time range to query. The value must be a 13-digit timestamp.

Identifier

String

Yes

temperature

The identifier of the property.

  • If weak verification is used, you can perform the following steps to view the Identifier of a device property: Log on to the IoT Platform console and 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.

  • If no verification is used, the value must be the same as the custom identifier that is submitted by the device.

PageSize

Integer

Yes

10

The maximum number of records that can be returned for each property. Maximum value: 100.

The number of records that are returned for an arbitrary property cannot exceed the limit.

StartTime

Long

Yes

1569249488000

The start of the time range to query. The value must be a 13-digit timestamp.

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 to configure this parameter.

For more information, see Overview.

ProductKey

String

No

a1BwAGV****

The ProductKey of the product to which the device belongs.

Important

If you specify a value for this parameter, you must configure the DeviceName parameter.

DeviceName

String

No

light

The DeviceName of the device.

Important

If you specify a value for this parameter, you must configure the ProductKey parameter.

NextPageToken

String

No

Bo***x44Qx

The token that is used to retrieve the next page of the query results. If the next page exists, this parameter is returned. In this case, you must add the value of the parameter to the next request.

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.

Important

The IotId parameter specifies a unique ID for the device. The value of the IotId parameter is equivalent to a combination of the values of the ProductKey and DeviceName.N parameters. If you specify the IotId parameter, you do not need to configure the ProductKey or DeviceName.N parameter. If you specify values for the IotId, ProductKey, and DeviceName.N parameters, the value of the IotId parameter takes precedence.

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.device.InvalidIoTId

The error code returned if the call fails. For more information, see Error codes.

Data

Struct

The property records returned if the call is successful.

List

Array of PropertyInfo

The properties. Each element indicates a property.

PropertyInfo

Time

String

1516541885630

The time when the property was modified.

Value

String

{\"data\":32.43}

The value of the property.

NextValid

Boolean

true

Indicates whether the next page exists.

  • true: The next page exists.

  • false: The next page does not exist.

If true is returned for the NextValid parameter, you can add the value of the NextPageToken parameter to the next request. This way, you can query the data that is not included in the current query.

nextPageToken

String

Bo***x44Qx

The token that is used to retrieve the next page of the query results.

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. Valid values:

  • true: The call was successful.

  • false: The call failed.

Examples

Sample requests

http(s)://iot.cn-shanghai.aliyuncs.com/?Action=QueryDeviceOriginalPropertyData
&Asc=0
&EndTime=1579249499000
&Identifier=temperature
&PageSize=10
&StartTime=1569249488000
&IotId=Q7uOhVRdZRRlDnTLv****00100
&<Common request parameters>

Sample success responses

XML format

<QueryDeviceOriginalPropertyDataResponse>
  <RequestId>DD8EE383-F007-5647-8B6B-0C52FAC3E7F2</RequestId>
  <Data>
        <NextValid>true</NextValid>
        <nextPageToken>MTcxMjc0N***********</nextPageToken>
        <List>
              <PropertyInfo>
                    <Value>{"data":31.26}</Value>
                    <Time>1712747043556</Time>
              </PropertyInfo>
              <PropertyInfo>
                    <Value>{"data":32.43}</Value>
                    <Time>1712747043108</Time>
              </PropertyInfo>
              <PropertyInfo>
                    <Value>{"data":30.58}</Value>
                    <Time>1712747042619</Time>
              </PropertyInfo>
              <PropertyInfo>
                    <Value>{"data":32.49}</Value>
                    <Time>1712747042182</Time>
              </PropertyInfo>
              <PropertyInfo>
                    <Value>{"data":30.66}</Value>
                    <Time>1712747041731</Time>
              </PropertyInfo>
        </List>
  </Data>
  <Code></Code>
  <Success>true</Success>
</QueryDeviceOriginalPropertyDataResponse>

JSON format

{
  "RequestId": "DD8EE383-F007-5647-8B6B-0C52FAC3E7F2",
  "Data": {
    "NextValid": true,
    "nextPageToken": "MTcxMjc0N***********",
    "List": {
      "PropertyInfo": [
        {
          "Value": "{\"data\":31.26}",
          "Time": 1712747043556
        },
        {
          "Value": "{\"data\":32.43}",
          "Time": 1712747043108
        },
        {
          "Value": "{\"data\":30.58}",
          "Time": 1712747042619
        },
        {
          "Value": "{\"data\":32.49}",
          "Time": 1712747042182
        },
        {
          "Value": "{\"data\":30.66}",
          "Time": 1712747041731
        }
      ]
    }
  },
  "Code": "",
  "Success": true
}

Error codes

For a list of error codes, see Service error codes.