Skip to content

健康检查 API ​

检查服务健康状态及 KV 存储可用性。响应遵循 JSON:API 规范。

❤️ 接口信息 ​

  • 接口路径: /health
  • 请求方法: GET
  • 响应格式: JSON(application/vnd.api+json)

🚀 快速开始 ​

基础调用 ​

bash
curl https://api.160621.xyz/v1/health

成功响应 200 ​

json
{
  "jsonapi": { "version": "1.0" },
  "data": {
    "type": "health",
    "id": "service",
    "attributes": {
      "status": "healthy",
      "timestamp": "2026-07-13T12:00:00.000Z",
      "kvStorage": "available",
      "env": "production"
    }
  }
}

错误响应 ​

服务不可用时返回 503:

json
{
  "jsonapi": { "version": "1.0" },
  "errors": [
    {
      "status": "503",
      "code": "SERVICE_UNAVAILABLE",
      "title": "服务不可用",
      "detail": "错误信息"
    }
  ]
}

📋 响应字段 ​

字段类型说明
statusstring服务状态(healthy)
timestampstring服务时间戳
kvStoragestringKV 存储状态(available / not configured)
envstring运行环境标识

⚙️ 环境变量 ​

变量说明
KV_DEFAULT检测 KV 存储是否可用
testenv环境标识(通过 env.testenv 读取)

基于 EdgeOne 边缘计算平台构建