为设备属性值和相关资源值提供查询接口
功能描述:查询指定设备的多个属性值的最新值。
GET /api/v1/data/properties/recent/value
Query:
Name | Type | Description | Required |
---|---|---|---|
deviceId | int | 设备ID | Yes |
propertyNames | string | 属性名逗号拼接 | Yes |
cURL example:
curl --location --request GET '{{address}}/api/v1/data/properties/recent/value?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}&deviceId={deviceId}&propertyNames={propertyNames}' \
--header 'projectId: {projectId}'
Response body:
Name | Type | Description |
---|---|---|
eventId | string | 日志ID |
productId | number | 产品ID |
deviceId | string | 设备ID |
protocol | string | 协议类型 |
name | string | 属性名 |
value | 取决于属性具体类型 | 属性值 |
created | long | 属性数据创建毫秒时间戳 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data":[
{
"eventId": "991466b0-6d03-4508-88d6-2dc86e7fc618",
"deviceId": "22",
"productId": "17",
"protocol": "MQTT-STANDARD",
"name": "test",
"value": 60,
"created": 1552040792038
}
]
}
功能描述:提供分页查询资源某时间段数据点。
GET /api/v1/data/device/{deviceId}
Query:
Name | Type | Description | Required |
---|---|---|---|
resourceName | string | 资源名称 | No |
start | long | 查询开始时间 | Yes |
end | long | 查询结束时间 | Yes |
currentPage | int | 当前页码 | Yes |
pageSize | int | 页码大小 | Yes |
cURL example:
curl --location --request GET '{{address}}/api/v1/data/device/{deviceId}?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}&resourceName={resourceName}&start={start}&end={end}¤tPage={currentPage}&pageSize={pageSize}' \
--header 'projectId: {projectId}'
Response body:
Name | Type | Description |
---|---|---|
eventId | string | 日志ID |
productId | number | 产品ID |
deviceId | string | 设备ID |
protocol | string | 协议类型 |
name | string | 属性名 |
value | 取决于属性具体类型 | 属性值 |
created | long | 属性数据创建毫秒时间戳 |
Response example:
注:totalCount和totalPage字段值均为0
{
"success": true,
"code": 0,
"msg": "",
"data":{"content":
[
{
"eventId": "991466b0-6d03-4508-88d6-2dc86e7fc618",
"deviceId": "22",
"productId": "17",
"protocol": "MQTT-STANDARD",
"name": "test",
"value": 60,
"created": 1552040792038
}
],
"currentPage":1,
"pageSize":1,
"totalCount":0,
"totalPage":0
}
}
功能描述:查询指定时间段系统的全部数据点,仅限顶层用户使用。
GET /api/v1/data/events/all
Query:
Name | Type | Description | Required |
---|---|---|---|
start | long | 查询开始时间 | Yes |
end | long | 查询结束时间 | Yes |
cURL example:
curl --location --request GET '{{address}}/api/v1/data/events/all?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}&start=1600759158000&end=1600931958000'
Response body:
Name | Type | Description |
---|---|---|
eventId | string | 日志ID |
productId | number | 产品ID |
deviceId | string | 设备ID |
protocol | string | 协议类型 |
name | string | 属性名 |
value | 取决于属性具体类型 | 属性值 |
created | long | 属性数据创建毫秒时间戳 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data":[
{
"eventId": "991466b0-6d03-4508-88d6-2dc86e7fc618",
"deviceId": "22",
"productId": "17",
"protocol": "MQTT-STANDARD",
"name": "test",
"value": 60,
"created": 1552040792038
}
]
}