跳转到主要内容

端点

GET /api/v1/pulse/providers

概览

检索系统中所有可用健康设备提供商的信息,包括其配置状态和能力。

请求

curl http://localhost:18080/api/v1/pulse/providers

响应

{
  "code": 0,
  "msg": "ok",
  "data": {
    "providers": [
      {
        "slug": "theta_garmin",
        "name": "Garmin Connect",
        "platform": "theta",
        "description": "连接您的 Garmin 设备以同步活动、睡眠和健康指标",
        "logo": "https://static.thetahealth.ai/res/garmin.png",
        "supported": true,
        "auth_type": "oauth1",
        "status": "available",
        "capabilities": ["activity", "sleep", "heart_rate", "stress"]
      },
      {
        "slug": "theta_whoop",
        "name": "Whoop",
        "platform": "theta",
        "description": "连接您的 Whoop 表带以进行恢复、压力和睡眠追踪",
        "logo": "https://static.thetahealth.ai/res/whoop.png",
        "supported": true,
        "auth_type": "oauth2",
        "status": "available",
        "capabilities": ["recovery", "strain", "sleep", "heart_rate"]
      },
      {
        "slug": "apple_health",
        "name": "Apple Health",
        "platform": "apple",
        "description": "导入 Apple Health 导出数据",
        "logo": "https://static.thetahealth.ai/res/apple.png",
        "supported": true,
        "auth_type": "file_upload",
        "status": "available",
        "capabilities": ["activity", "sleep", "heart_rate", "nutrition", "workouts"]
      }
    ]
  }
}

响应字段

code
integer
必填
响应代码 (0 = 成功)
msg
string
必填
响应消息
data
object
必填
包含提供商数组的响应数据

平台类型

平台描述示例
theta基于 OAuth 的可穿戴设备提供商Garmin, Whoop, Fitbit
appleApple Health 平台 (文件上传)Apple Health 导出, CDA 文档
vitalVital API 集成通过 Vital 连接的各种设备

示例用法

import aiohttp

async def list_providers():
    async with aiohttp.ClientSession() as session:
        async with session.get("http://localhost:18080/api/v1/pulse/providers") as resp:
            providers = await resp.json()
            return providers["data"]["providers"]

providers = await list_providers()
for provider in providers:
    print(f"{provider['name']}: {provider['status']}")
在链接提供商或查询特定提供商的数据时,请使用 slug 字段。