Files
iot-util/查询设备数据点.txt
2026-06-03 11:11:09 +08:00

91 lines
3.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
查询设备数据点
最近更新时间:2026-01-16 16:47:29
接口功能
根据产品id和设备名称查询,时间范围参数,查询设备历史数据点信息
备注
仅支持数据流、IPSO数据协议,设备能正常下发上报
接口地址
http(s)://iot-api.heclouds.com/datapoint/history-datapoints
API说明
请求方式:GET
http query 请求参数:
参数 类型 是否必选 描述
datastream_id string 否 数据流ID,多个id之间用逗号分开,缺省时取数据流或数据流模板100条为缺省数据流id条件
product_id string 是 产品ID,平台生成唯一ID
device_name string 是 设备名称
imei string 否 lwm2m协议时传,设备imei
start string 否 提取数据点的开始时间,精确到秒,示例:2015-01-10T08:00:35
end string 否 提取数据点的结束时间,精确到秒,示例:2015-01-10T08:00:35
duration int 否 查询时间区间,单位为秒
limit int 否 限定本次请求最多返回的数据点数,默认100,范围为(0,6000]
cursor string 否 指定本次请求继续从cursor位置开始提取数据
sort enum 否 时间排序方式,DESC:倒序,ASC:升序,默认为DESC
返回数据
参数名称 类型 描述
code int 调用成功或失败时,返回的code码
msg string 调用成功或失败时,返回的msg信息
request_id string 调用API生成的请求标识
data - 调用成功时,返回的业务数据
data.count int 本次返回的数据点数量
data.cursor string 本次请求若未能返回所有数据,则会返回cursor参数,用户可以携带cursor参数进行再次请求,获取剩下的数据
data.datastreams array-json 设备数据流信息的json数组,见datastreams描述
datastreams描述表
参数名称 格式 说明
id string 数据流名称
datapoints array-json 数据点信息的json数组,见datapoints描述表
datapoints描述表
参数名称 格式 说明
at string 数据记录时间
value string/int/json... 数据点的值
特别说明
当startend时间均为空
i) limit
不传值或传值等于1时:排序为升序则查询最早一个数据点(30天内),否则查询最新数据点(最新缓存数据)
ii) limit
传值大于1时:排序为升序则查询最早x条数据点,否则查询最新x条数据点(30天内,x=limit)
示例
请求示例
GET http(s)://iot-api.heclouds.com/datapoint/history-datapoints
?product_id=XhONWQ5zV5&device_name=mqtts-dev&datastream_id=ds&start=2017-01-01T00:00:00&limit=100
响应示例
{
"data":{
"cursor":"25971_564280_1448961152173",
"count":5,
"datastreams":[
{
"datapoints":[
{
"at":"2015-12-01 17:10:24.981",
"value":"35"
},
{
"at":"2015-12-01 17:10:53.406",
"value":"38"
},
...
],
"id":"3200_0_5501"
},
...
]
},
"request_id": "a25087f46df04b69b29e90ef0acfd115",
"msg": "succ",
"code": 0
}