该接口支持根据参数查询仪表盘数据。
请求接口
POST /api/dashboard/_multi
请求参数
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
X-Access-Token | header | string | true | 平台token |
body | body | [object] | true | - |
» body | body | object | true | - |
»» dashboard | body | string | true | 仪表对象类型 |
»» object | body | string | true | 仪表对象 |
»» measurement | body | string | true | 指标 |
»» dimension | body | string | true | 维度 |
»» group | body | string | false | 分组 |
»» params | body | [object] | false | 参数 |
»»» time | body | string | false | 时间 |
»»» format | body | string | false | 格式 |
»»» limit | body | integer | false | 数量 |
»»» from | body | integer | false | 开始时间 |
»»» to | body | integer | false | 结束时间 |
响应参数
以200 Response为例,响应参数如下:
名称 | 类型 | 必选 | 约束 | 说明 |
---|---|---|---|---|
» message | string | true | none | 返回信息 |
» result | [object] | true | none | 返回结果 |
»» group | string | true | none | 与请求参数相同 |
»» data | object | true | none | 数据 |
»»» value | string | true | none | 内容 |
»»» timeString | string | true | none | 时间 |
»»» timestamp | string | true | none | 时间戳 |
» status | integer | true | none | 响应状态码 |
» timestamp | integer | true | none | 时间戳 |
响应状态码
状态码 | 状态码含义 | 说明 |
---|---|---|
200 | OK | 成功 |
401 | Unauthorized | 登录状态已过期,token不能为空 |
500 | Internal Server Error | 服务器内部异常 |
Body示例
- 近一周数据:
json
[
{
"dashboard": "device",
"object": "message",
"measurement": "quantity",
"dimension": "agg",
"group": "device_msg",
"params": {
"time": "1d",
"format": "M月dd日",
"limit": 7,
"from": 1698239305402,
"to": 1698757705402
}
}
]
[
{
"dashboard": "device",
"object": "message",
"measurement": "quantity",
"dimension": "agg",
"group": "device_msg",
"params": {
"time": "1d",
"format": "M月dd日",
"limit": 7,
"from": 1698239305402,
"to": 1698757705402
}
}
]
- 近一月数据:
json
[
{
"dashboard": "device",
"object": "message",
"measurement": "quantity",
"dimension": "agg",
"group": "device_msg",
"params": {
"time": "1d",
"format": "M月dd日",
"limit": 30,
"from": 1696251987247,
"to": 1698757587247
}
}
]
[
{
"dashboard": "device",
"object": "message",
"measurement": "quantity",
"dimension": "agg",
"group": "device_msg",
"params": {
"time": "1d",
"format": "M月dd日",
"limit": 30,
"from": 1696251987247,
"to": 1698757587247
}
}
]
- 近一年数据:
json
[
{
"dashboard": "device",
"object": "message",
"measurement": "quantity",
"dimension": "agg",
"group": "device_msg",
"params": {
"time": "1M",
"format": "yyyy年-M月",
"limit": 12,
"from": 1667221747329,
"to": 1698757747329
}
}
]
[
{
"dashboard": "device",
"object": "message",
"measurement": "quantity",
"dimension": "agg",
"group": "device_msg",
"params": {
"time": "1M",
"format": "yyyy年-M月",
"limit": 12,
"from": 1667221747329,
"to": 1698757747329
}
}
]
返回示例
以200 Response为例,近一周数据:
json
{
"message": "success",
"result": [
{
"group": "device_msg",
"data": {
"value": 86278,
"timeString": "8月24日",
"timestamp": 0
}
},
{
"group": "device_msg",
"data": {
"value": 110168,
"timeString": "8月23日",
"timestamp": 1
}
},
{
"group": "device_msg",
"data": {
"value": 113163,
"timeString": "8月22日",
"timestamp": 2
}
},
{
"group": "device_msg",
"data": {
"value": 146420,
"timeString": "8月21日",
"timestamp": 3
}
},
{
"group": "device_msg",
"data": {
"value": 96630,
"timeString": "8月20日",
"timestamp": 4
}
},
{
"group": "device_msg",
"data": {
"value": 106054,
"timeString": "8月19日",
"timestamp": 5
}
},
{
"group": "device_msg",
"data": {
"value": 45386,
"timeString": "8月18日",
"timestamp": 6
}
}
],
"status": 200,
"timestamp": 1692864175646
}
{
"message": "success",
"result": [
{
"group": "device_msg",
"data": {
"value": 86278,
"timeString": "8月24日",
"timestamp": 0
}
},
{
"group": "device_msg",
"data": {
"value": 110168,
"timeString": "8月23日",
"timestamp": 1
}
},
{
"group": "device_msg",
"data": {
"value": 113163,
"timeString": "8月22日",
"timestamp": 2
}
},
{
"group": "device_msg",
"data": {
"value": 146420,
"timeString": "8月21日",
"timestamp": 3
}
},
{
"group": "device_msg",
"data": {
"value": 96630,
"timeString": "8月20日",
"timestamp": 4
}
},
{
"group": "device_msg",
"data": {
"value": 106054,
"timeString": "8月19日",
"timestamp": 5
}
},
{
"group": "device_msg",
"data": {
"value": 45386,
"timeString": "8月18日",
"timestamp": 6
}
}
],
"status": 200,
"timestamp": 1692864175646
}