所有读取和写入用户数据的 Google Health API 端点都需要用户通过一个或多个范围同意数据收集。应用在调用 Google 的 OAuth2 身份验证端点时,必须提供范围列表。请参阅 获取 OAuth2 访问 令牌。 颁发的访问令牌将仅包含同意用户已授权的范围。
所有 Google Health API 范围均以以下内容开头:
https://www.googleapis.com/auth/googlehealth
可用的范围
| 范围 | 权限 |
|---|---|
| .activity_and_fitness.readonly | 查看您在 Google Health 中的活动和健身数据。 |
| .activity_and_fitness.writeonly | 向 Google Health 添加活动和健身数据,以及修改或删除所添加的这类数据。 |
| .ecg.readonly | 查看您在 Google Health 中的心电图数据。 |
| .health_metrics_and_measurements.readonly | 查看您在 Google Health 中的健康指标和测量数据。 |
| .health_metrics_and_measurements.writeonly | 向 Google Health 添加健康指标和测量数据,以及修改或删除所添加的这类数据。 |
| .irn.readonly | 查看您在 Google Health 中的心律不齐通知数据。 |
| .location.readonly | 查看您在 Google Health 中锻炼期间记录的 GPS 位置信息。 |
| .nutrition.readonly | 查看您在 Google Health 中的营养数据。 |
| .nutrition.writeonly | 向 Google Health 添加营养数据,以及修改或删除所添加的这类数据。 |
| .profile.readonly | 查看您在 Google Health 中的个人资料数据。 |
| .profile.writeonly | 向 Google Health 添加个人资料数据,以及修改或删除所添加的这类数据。 |
| .settings.readonly | 查看您在 Google Health 中的设置。 |
| .settings.writeonly | 向 Google Health 添加设置数据,以及修改或删除所添加的这类数据。 |
| .sleep.readonly | 查看您在 Google Health 中的睡眠数据。 |
| .sleep.writeonly | 向 Google Health 添加睡眠数据,以及修改或删除所添加的这类数据。 |