API 사양

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 범위 매핑
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.readonly
.sleep.writeonly
기온 .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly
무게 .health_metrics_and_measurements.readonly
.health_metrics_and_measurements.writeonly

데이터 유형

다음은 Google Health API 데이터 유형과 Fitbit Web API에 매핑되는 방식의 목록입니다.

표: Fitbit Web API에서 Google Health 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 요약 일일 심박 변이도
  daily-heart-rate-variability
SpO2 요약 일일 산소 포화도
  daily-oxygen-saturation
안정 시 심박수 일일 안정 시 심박수
  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
불규칙한 심장 리듬 알림 (IRN) 심방세동 알림
  irregular-rhythm-notification
음식 기록 영양 기록
  nutrition-log
SpO2 Intraday 산소 포화도
  oxygen-saturation
사용자가 달릴 때의 최대 산소 섭취량 값 러닝 최대 산소 섭취량
  run-vo2-max
활동 시계열 분(앉아 있음) 앉아 있는 기간
  sedentary-period
수면 수면
  sleep
단계 단계
  steps
활동 시계열 수영 스트로크 수영 길이 데이터
  swim-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 프로필 엔드포인트의 예입니다.

GET https://health.googleapis.com/v4/users/me/profile

엔드포인트 매핑

사용 가능한 데이터 유형 및 지원되는 API 메서드 목록은 Google Health API 데이터 유형 표를 참고하세요.

Fitbit Web API 엔드포인트 유형 Google Health API
하루 동안의 데이터를 요청하는 GET (로그 | 요약 | 일일 요약) windowSize = 1일인 dailyRollup 메서드
세분화된 데이터를 요청하는 GET (Intraday) list 메서드
날짜 또는 간격별 GET (시계열) 날짜 범위를 포함하는 rollUp 또는 dailyRollUp 메서드
GET (로그 목록) list 메서드
로그 만들기 및 업데이트 patch 메서드
로그 삭제 batchDelete 메서드
프로필 가져오기 users.getProfile 은 사용자의 특정 정보를 반환합니다.
users.getSettings 는 사용자의 단위 및 시간대를 반환합니다.
프로필 업데이트 users.updateProfile 은 사용자의 특정 정보를 수정합니다.
users.updateSettings 는 사용자의 단위 및 시간대를 수정합니다.
사용자 ID 가져오기 users.getIdentity 는 사용자의 Fitbit 기존 및 Google 사용자 ID를 반환합니다.
기기 가져오기 users.pairedDevices 는 페어링된 기기 목록을 반환합니다.
구독 만들기 projects.subscribers.subscriptions.create 는 구독을 수동으로 만듭니다.
구독 삭제 projects.subscribers.subscriptions.delete 는 구독을 삭제합니다.
구독 목록 가져오기 projects.subscribers.subscriptions.list 는 모든 구독을 나열합니다.