API 仕様セクションでは、認証スコープ、データ型の定義、エンドポイント構造など、プラットフォームとの統合に不可欠な技術コンポーネントの詳細な概要を提供します。この API は、より安定した一貫性のあるデベロッパー エクスペリエンスを確保するために最新のインフラストラクチャで再構築された、従来の Fitbit Web API の戦略的な進化を表しています。
スコープ
Google Health API スコープを使用するように認証リクエストを更新する必要があります。スコープは、アプリが読み取りオペレーションと書き込みオペレーションのどちらをサポートするかを定義します。アプリに不要なスコープは使用しないでください。アプリの設計が変更された場合は、後でスコープを追加できます。
Google Health API のスコープは、https://www.googleapis.com/auth/googlehealth.{scope} で始まる HTTP URL です。例: https://www.googleapis.com/auth/googlehealth.activity_and_fitness.writeonly。
スコープ マッピング
Fitbit Web API スコープと Google Health API スコープの対応は次のとおりです。
| Fitbit Web API のスコープ | Google Health API のスコープ |
|---|---|
| アクティビティ | .activity_and_fitness.readonly
.activity_and_fitness.writeonly |
| blood_glucose | .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly |
| cardio_fitness | .activity_and_fitness.readonly
.activity_and_fitness.writeonly |
| 心電図 | .ecg.readonly
|
| 心拍数 | .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly |
| irregular_rhythm_notifications | .irn.readonly
|
| ロケーション | .location.readonly
|
| 栄養 | .nutrition.readonly
.nutrition.writeonly |
| oxygen_saturation | .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly |
| プロフィール | .profile.readonly
.profile.writeonly |
| respiratory_rate | .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly |
| 設定 | .settings.readonly
.settings.writeonly |
| sleep | .sleep.readonly
.sleep.writeonly |
| 温度 | .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly |
| weight | .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly |
データ型
Google Health API のデータ型と Fitbit Web API へのマッピング方法のリストは次のとおりです。
| Fitbit Web API のデータ型 | Google Health API のデータ型dataType |
|---|---|
| アクティビティのカロリー | 消費カロリーactive-energy-burned
|
| アクティブ ゾーン時間 | アクティブ ゾーン時間active-zone-minutes
|
| ユーザーのアクティビティ レベルの変更が含まれます | アクティビティ レベルactivity-level
|
| 高度 | 高度altitude
|
| 血糖値 | 血糖値blood-glucose
|
| 体脂肪 | 体脂肪率body-fat
|
各心拍ゾーンの滞在時間: caloriesOut |
心拍ゾーン内の消費カロリーcalories-in-heart-rate-zone
|
| 温度(深部) | 深部体温core-body-temperature
|
| HRV の概要 | 1 日の心拍変動daily-heart-rate-variability
|
| 血中酸素ウェルネスの概要 | 1 日の酸素飽和度daily-oxygen-saturation
|
| 安静時の心拍数 | 1 日の安静時の心拍数daily-resting-heart-rate
|
| 皮膚温 | 毎日の睡眠時の体温の推移daily-sleep-temperature-derivations
|
| 距離 | 距離distance
|
| 心電図(ECG) | 心電図(ECG)electrocardiogram
|
| 記録されたアクティビティ | エクササイズexercise
|
| 階数 | 階数floors
|
| 食べ物 | 食べ物food
|
| 食品の測定単位 | 食品の測定単位food-measurement-unit
|
| 心拍数 | 心拍数heart-rate
|
| HRV Intraday | 心拍変動heart-rate-variability
|
| 不整脈の通知 | 不整脈の通知irregular-rhythm-notification
|
| 食事の記録 | 栄養摂取量の記録nutrition-log
|
| 血中酸素ウェルネス(1 日) | 酸素飽和度oxygen-saturation
|
| ユーザーがランニングしたときの VO2 最大値 | ランニング時の最大酸素摂取量run-vo2-max
|
| アクティビティの時系列(分) - 座りがち | Sedentary Periodsedentary-period
|
| 睡眠 | 睡眠sleep
|
| 手順 | 手順steps
|
| アクティビティの時系列のストローク数(水泳) | Swim Lengths Dataswim-lengths-data
|
活動 caloriesOut |
総カロリーtotal-calories
|
| 最大酸素摂取量の値 | 最大酸素摂取量vo2-max
|
| 重量 | 重みweight
|
エンドポイント
REST エンドポイントでは、すべてのデータ型で一貫した構文が採用されています。
- サービス エンドポイント: ベース HTTP URL が https://health.googleapis.com に変更されます。
- エンドポイントの構文: Google Health API は、サポートされているデータ型のほとんどで使用できるエンドポイントを少数サポートしています。これにより、すべてのデータ型で一貫した構文が提供され、エンドポイントが使いやすくなります。
- ユーザー識別子: エンドポイント構文で、ユーザー ID または me のいずれかを指定する必要があります。me を使用する場合、ユーザー ID はアクセス トークンから推測されます。
例: Google Health API を使用して呼び出される GET Profile エンドポイントの例を次に示します。
GET https://health.googleapis.com/v4/users/me/profile
エンドポイント マッピング
利用可能なデータ型と、それらがサポートする API メソッドの一覧については、Google Health API のデータ型の表をご覧ください。
| Fitbit Web API エンドポイント タイプ | Google Health API |
| 1 日分のデータをリクエストする GET(Log | Summary | Daily Summary) | windowSize = 1 日の dailyRollup メソッド |
| 詳細なデータをリクエストする GET(当日) | list メソッド |
| 日付または間隔で GET(時系列) | 日付範囲を含む rollUp メソッドまたは dailyRollUp メソッド |
| GET(ログリスト) | list メソッド |
| CREATE と UPDATE のログ | patch メソッド |
| ログを削除する | batchDelete メソッド |
| GET Profile | users.getProfile はユーザーの特定の情報を返します。 users.getSettings はユーザーの単位とタイムゾーンを返します。 |
| プロファイルを更新する | users.updateProfile はユーザーの特定の情報を変更します
users.updateSettings はユーザーの単位とタイムゾーンを変更します |
| ユーザー ID を取得する | users.getIdentity は、ユーザーの Fitbit の以前のユーザー ID と Google ユーザー ID を返します。 |
| デバイスを取得する | users.pairedDevices は、ペア設定されたデバイスのリストを返します。 |
| サブスクリプションを作成する | projects.subscribers.subscriptions.create は、サブスクリプションを手動で作成します。 |
| サブスクリプションを削除する | projects.subscribers.subscriptions.delete: サブスクリプションを削除する |
| 定期購入リストを取得する | projects.subscribers.subscriptions.list は、すべてのサブスクリプションを一覧表示します。 |