1. 接口描述
接口请求域名:
iot.cloud.tencent.com/api/exploreropen/tokenapi
。
本接口(AppGetDeviceDataHistory)用于获取设备物模型历史数据。2. 输入参数
名称 | 类型 | 必选 | 描述 |
AccessToken | String | 是 | 公共参数,AccessToken 用于对一个已经登录的用户鉴权。 |
RequestId | String | 是 | 公共参数,唯一请求 ID,可自行生成,推荐使用 uuId。定位问题时,需提供该次请求的 RequestId。 |
Action | String | 是 | 公共参数,本接口取值:AppGetDeviceDataHistory。 |
ProductId | String | 是 | 产品 ID。 |
DeviceName | String | 是 | 设备名。 |
FieldName | String | 是 | 查询的属性名称。 |
Context | String | 否 | 翻页游标,首次查询时,可不带。 |
MinTime | Int | 是 | 开始时间,毫秒时间戳。 |
MaxTime | Int | 是 | 结束时间,毫秒时间戳。 |
Limit | Int | 是 | 单页数据量。 |
3. 输出参数
名称 | 类型 | 描述 |
RequestId | String | 公共参数,唯一请求 ID,与入参相同,定位问题时,需提供该次请求的 RequestId。 |
Context | String | 翻页游标。 |
FieldName | String | 查询的属性名称。 |
Listover | Bool | 数据是否查询完。 True 表示未读取完可继续读取。 False 表示已全部读取完。 |
Results | Array of DataHistoryItem | 返回数据。 |
4. 示例
示例1
输入示例
POST https://iot.cloud.tencent.com/api/exploreropen/tokenapi HTTP/1.1content-type: application/json{"RequestId": "f92406b3-5a9a-4fe8-bc43-45e3d794bb68","Action": "AppGetDeviceDataHistory","ProductId": "22F9Y6II7O","DeviceName": "light1","MinTime": 1560949017000,"MaxTime": 1561035417000,"Limit": 20,"FieldName": "light_switch","AccessToken": "8b4a70dd16105f******************18edd4e78a3bb8ec"}
输出示例: 成功
{"Response": {"Context": "abc","FieldName": "brightness","Listover": false,"RequestId": "f92406b3-5a9a-4fe8-bc43-45e3d794bb68","Results": [{"Time": "1560949025494","Value": "77"}]}}
5. 错误码
错误码 | 描述 |
InternalError | 内部错误。 |
InvalidParameterValue | 参数取值错误。 |
InvalidParameterValue.InvalidAccessToken | Token 无效。 |