Skip to content

Fetch data in JSON format

wumingshi edited this page Dec 7, 2024 · 1 revision

该程序保留了 /api/data 接口用于以 JSON 格式获取数据。

示例:https://status.lyc8503.net/api/data

示例响应:

{
  "up": 6,    // 当前有 6 个正常运行的监控...
  "down": 1,  // ...以及 1 个故障监控
  "updatedAt": 1719764731, // 最后更新时间戳
  "monitors": {
    "www": {               // 键值为配置中的 `id`
      "up": true,          // 当前状态(布尔值)
      "latency": 65,       // 上次监控的延迟
      "location": "SIN",   // 上次监控使用的数据中心
      "message": "OK"      // 当前状态描述(如果是故障状态则为错误信息)
    },
    "homelab": {
      "up": false,
      "latency": 1896,
      "location": "SJC",
      "message": "HTTP response doesn't contain the configured keyword"
    },
    //......
  }
}

Clone this wiki locally