端点
复制
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"]
}
]
}
}
响应字段
响应代码 (0 = 成功)
响应消息
包含提供商数组的响应数据
显示 data 对象
显示 data 对象
提供商对象数组
显示 Provider 对象
显示 Provider 对象
唯一的提供商标识符 (例如
theta_garmin, apple_health)提供商的显示名称
平台类型:
theta (OAuth 提供商), apple (基于文件), vital (Vital API)提供商描述和能力
提供商徽标图片的 URL
提供商当前是否受支持
身份验证方法:
oauth1, oauth2, file_upload, token提供商状态:
available, unavailable 或 maintenance提供商支持的数据类型列表 (例如
activity, sleep, heart_rate)平台类型
| 平台 | 描述 | 示例 |
|---|---|---|
theta | 基于 OAuth 的可穿戴设备提供商 | Garmin, Whoop, Fitbit |
apple | Apple Health 平台 (文件上传) | Apple Health 导出, CDA 文档 |
vital | Vital 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 字段。