Call this operation to query the historical data of multiple properties of a device.

Limits

  • Up to 10 properties can be queried at a time.
  • Up to 100 data records of each property can be queried at a time.
  • You can query property data that was generated or modified within the last 30 days.
    Note The data of a property is stored from the day the property was generated or modified. Data that was generated more than 30 days ago is no longer stored.

Request parameters

Parameter Type Required Description
Action String Yes The operation to be performed. Set the value to QueryDevicePropertiesData.
ProductKey String Yes The unique identifier of the product to which the device belongs.
DeviceName String Yes The device name.
Identifiers List Yes The identifiers of the properties that you want to query. In the IoT Platform console, you can see your defined property identifiers on the Define Feature page of the product.

You cannot enter duplicate property identifiers.

StartTime Long  Yes The start time of the property record that you want to query. The value is a 13-bit timestamp.
EndTime Long  Yes The end time of the property record. The value is a 13-bit timestamp.
PageSize Integer Yes Specify the number of data records of each property that will be returned. The maximum value is 100.

The record number of any property returned does not exceed this value.

Asc Integer Yes The ordering method for property data in the response. The property data records are sorted by time. Value options:
  • 0: In reverse chronological order. The value of StartTime must be later than that of EndTime.
  • 1: In chronological order. The value of StartTime must be earlier than that of EndTime.
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.
NextValid Boolean Indicates whether there is another page of property records. true: Yes. false: No.

If the returned value of NextValid is true, you can use the value of NextTime as the StartTime value for another call to query the property records that have not been displayed in this query.

NextTime Long The start time of the property record on the next page.

You can use the value of NextTime as the StartTime value for another call to query the property records that have not been displayed in this query.

Code String The error code returned when the call fails. See Error codes.
PropertyDataInfos List A collection of property records returned when the call is successful. For more information, see the following PropertyDataInfo table.
Table 1. PropertyDataInfo
Parameter Type Description
Identifier String The identifier of the property.
List List The property records. For more information, see the following PropertyInfo table.
Table 2. PropertyInfo
Parameter Type Decription
Time Long The time when the property is reported.
Value String The value of the property.

Examples

Request example

https://iot.cn-shanghai.aliyuncs.com/?Action=QueryDevicePropertiesData
&Asc=0
&DeviceName=water
&EndTime=1540115948152
&Identifier. 1=Weight
&Identifier. 2=Circle
&PageSize=100
&ProductKey=a1bdOxkDbGC
&StartTime=1540116010723
&Common request parameters

Response example

  • JSON format

    {
    	"NextValid": true,
    	"NextTime": 1540115949818,
    	"RequestId": "75649FF8-36CD-421B-96C6-35B725FE823B",
    	"Success": true
    	"PropertyDataInfos": {
                 "PropertyDataInfo": [{
    		  "List":{
    			 "PropertyInfo": [{
    				"Value": "166.0",
    				"Time": 1540116010518
    			  },
    			  {
    				"Value": "166.0",
    				"Time": 1540116009906
    			  },
    			  {
    				"Value": "134.0",
    				"Time": 1540115951051
    			  },
    			  {
    				"Value": "133.0",
    				"Time": 1540115950431
    		          },
    			  {
    				"Value": "133.0",
    				"Time": 1540115949819
    			  }
    			]
    		      }, 
    		   "Identifier":"Circle"
        
    		 },
    		 {
    		  "List": {
    		          "PropertyInfo": [{
    				"Value": "99.0",
    				"Time": 1540116010314
    			  },
    			  {
    				"Value": "99.0",
    				"Time": 1540116009702
    			  },
    			  {
    				"Value": "98.0",
    				"Time": 1540116009090
    			  },
    			  {
    				"Value": "51.0",
    				"Time": 1540115950844
    			  },
    			  {
    				"Value": "50.0",
    				"Time": 154011595228
    			   }
    			 ]
    			},
    		   "Identifier": "Weight"
    		 }
    	   ]
         },
    }
  • XML format

    <? xml version="1.0" encoding="UTF-8" ? >
    <QueryDevicePropertiesData>
    	<NextValid>true</NextValid>
    	<NextTime>1540115949818</NextTime>
    	<RequestId>75649FF8-36CD-421B-96C6-35B725FE823B</RequestId>
    	<PropertyDataInfos>
    		<PropertyDataInfo>
    			<List>
    				<PropertyInfo>
    					<Value>166.0</Value>
    					<Time>1540116010518</Time>
    				</PropertyInfo>
    				<PropertyInfo>
    					<Value>166.0</Value>
    					<Time>1540116009906</Time>
    				</PropertyInfo>
    				<PropertyInfo>
    					<Value>134.0</Value>
    					<Time>1540115951051</Time>
    				</PropertyInfo>
    				<PropertyInfo>
    					<Value>133.0</Value>
    					<Time>1540115950431</Time>
    				</PropertyInfo>
    				<PropertyInfo>
    					<Value>133.0</Value>
    					<Time>1540115949819</Time>
    				</PropertyInfo>
    			</List>
    			<Identifier>Circle</Identifier>
    		</PropertyDataInfo>
    		<PropertyDataInfo>
    			<List>
    				<PropertyInfo>
    					<Value>99.0</Value>
    					<Time>1540116010314</Time>
    				</PropertyInfo>
    				<PropertyInfo>
    					<Value>99.0</Value>
    					<Time>1540116009702</Time>
    				</PropertyInfo>
    				<PropertyInfo>
    					<Value>98.0</Value>
    					<Time>1540116009090</Time>
    				</PropertyInfo>
    				<PropertyInfo>
    					<Value>51.0</Value>
    					<Time>1540115950844</Time>
    				</PropertyInfo>
    				<PropertyInfo>
    					<Value>50.0</Value>
    					<Time>1540115950228</Time>
    				</PropertyInfo>
    			</List>
    			<Identifier>Weight</Identifier>
    		</PropertyDataInfo>
    	</PropertyDataInfos>
    	<Success>true</Success>
    </QueryDevicePropertiesData>