Skip to content

获取仪表盘数据 (POST)

更新时间:

该接口支持根据参数查询仪表盘数据。

请求接口

POST /api/dashboard/_multi

TIP

访问权限:需要登录超级设备管理平台获取token,并校验token

请求参数

名称位置类型必选说明
X-Access-Tokenheaderstringtrue平台token
bodybody[object]true-
» bodybodyobjecttrue-
»» dashboardbodystringtrue仪表对象类型
»» objectbodystringtrue仪表对象
»» measurementbodystringtrue指标
»» dimensionbodystringtrue维度
»» groupbodystringfalse分组
»» paramsbody[object]false参数
»»» timebodystringfalse时间
»»» formatbodystringfalse格式
»»» limitbodyintegerfalse数量
»»» frombodyintegerfalse开始时间
»»» tobodyintegerfalse结束时间

响应参数

以200 Response为例,响应参数如下:

名称类型必选约束说明
» messagestringtruenone返回信息
» result[object]truenone返回结果
»» groupstringtruenone与请求参数相同
»» dataobjecttruenone数据
»»» valuestringtruenone内容
»»» timeStringstringtruenone时间
»»» timestampstringtruenone时间戳
» statusintegertruenone响应状态码
» timestampintegertruenone时间戳

响应状态码

状态码状态码含义说明
200OK成功
401Unauthorized登录状态已过期,token不能为空
500Internal 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
}