Skip to content

chemelli74/fitbit-web-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fitbit-web-api

Fitbit provides a Web API for accessing data from Fitbit activity trackers, Aria scale, and manually entered logs. Anyone can develop an application to access and modify a Fitbit user's data on their behalf, so long as it complies with Fitbit Platform Terms of Service. These Swagger UI docs do not currently support making Fitbit API requests directly. In order to make a request, construct a request for the appropriate endpoint using this documentation, and then add an Authorization header to each request with an access token obtained using the steps outlined here: https://dev.fitbit.com/build/reference/web-api/developer-guide/authorization/.

This Python package is automatically generated by the Swagger Codegen project:

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import fitbit_web_api

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import fitbit_web_api

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import fitbit_web_api
from fitbit_web_api.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: oauth2
configuration = fitbit_web_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = fitbit_web_api.ActiveZoneMinutesIntradayTimeSeriesApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' # date | The date in the format yyyy-MM-dd or today
detail_level = 'detail_level_example' # str | The detail for which data will be returned. **Supported:** 1min | 5min | 15min

try:
    # Get AZM Intraday by Date
    api_instance.get_azmby_date_intraday(_date, detail_level)
except ApiException as e:
    print("Exception when calling ActiveZoneMinutesIntradayTimeSeriesApi->get_azmby_date_intraday: %s\n" % e)

# Configure OAuth2 access token for authorization: oauth2
configuration = fitbit_web_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = fitbit_web_api.ActiveZoneMinutesIntradayTimeSeriesApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' # date | The date in the format yyyy-MM-dd or today
detail_level = 'detail_level_example' # str | The detail for which data will be returned. **Supported:** 1min | 5min | 15min
start_time = 'start_time_example' # str | The start of the period in the format HH:mm.
end_time = 'end_time_example' # str | The end of the period in the format HH:mm.

try:
    # Get AZM Intraday by Date
    api_instance.get_azmby_date_time_series_intraday(_date, detail_level, start_time, end_time)
except ApiException as e:
    print("Exception when calling ActiveZoneMinutesIntradayTimeSeriesApi->get_azmby_date_time_series_intraday: %s\n" % e)

# Configure OAuth2 access token for authorization: oauth2
configuration = fitbit_web_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = fitbit_web_api.ActiveZoneMinutesIntradayTimeSeriesApi(fitbit_web_api.ApiClient(configuration))
start_date = '2013-10-20' # date | The date in the format yyyy-MM-dd or today
end_date = '2013-10-20' # date | The date in the format yyyy-MM-dd or today
detail_level = 'detail_level_example' # str | The detail for which data will be returned. **Support:** 1min | 5min | 15min

try:
    # Get AZM Intraday by Interval
    api_instance.get_azmby_interval_intraday(start_date, end_date, detail_level)
except ApiException as e:
    print("Exception when calling ActiveZoneMinutesIntradayTimeSeriesApi->get_azmby_interval_intraday: %s\n" % e)

# Configure OAuth2 access token for authorization: oauth2
configuration = fitbit_web_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = fitbit_web_api.ActiveZoneMinutesIntradayTimeSeriesApi(fitbit_web_api.ApiClient(configuration))
start_date = '2013-10-20' # date | The date in the format yyyy-MM-dd or today
end_date = '2013-10-20' # date | The date in the format yyyy-MM-dd or today
detail_level = 'detail_level_example' # str | The detail for which data will be returned. **Support:** 1min | 5min | 15min
start_time = 'start_time_example' # str | The start of the period in the format HH:mm.
end_time = 'end_time_example' # str | The end of the period in the format HH:mm.

try:
    # Get AZM Intraday by Interval
    api_instance.get_azmby_interval_time_series_intraday(start_date, end_date, detail_level, start_time, end_time)
except ApiException as e:
    print("Exception when calling ActiveZoneMinutesIntradayTimeSeriesApi->get_azmby_interval_time_series_intraday: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.fitbit.com/

Class Method HTTP request Description
ActiveZoneMinutesIntradayTimeSeriesApi get_azmby_date_intraday GET /1/user/-/activities/active-zone-minutes/date/{date}/1d/{detail-level}.json Get AZM Intraday by Date
ActiveZoneMinutesIntradayTimeSeriesApi get_azmby_date_time_series_intraday GET /1/user/-/activities/active-zone-minutes/date/{date}/1d/{detail-level}/time/{start-time}/{end-time}.json Get AZM Intraday by Date
ActiveZoneMinutesIntradayTimeSeriesApi get_azmby_interval_intraday GET /1/user/-/activities/active-zone-minutes/date/{start-date}/{end-date}/{detail-level}.json Get AZM Intraday by Interval
ActiveZoneMinutesIntradayTimeSeriesApi get_azmby_interval_time_series_intraday GET /1/user/-/activities/active-zone-minutes/date/{start-date}/{end-date}/time/{start-time}/{end-time}.json Get AZM Intraday by Interval
ActiveZoneMinutesTimeSeriesApi get_azm_time_series_by_date GET /1/user/-/activities/active-zone-minutes/date/{date}/{period}.json Get AZM Time Series by Date
ActiveZoneMinutesTimeSeriesApi get_azm_time_series_by_interval GET /1/user/-/activities/active-zone-minutes/date/{start-date}/{end-date}.json Get AZM Time Series by Interval
ActivityApi add_activities_log POST /1/user/-/activities.json Log Activity
ActivityApi add_favorite_activities POST /1/user/-/activities/favorite/{activity-id}.json Add Favorite Activity
ActivityApi add_update_activities_goals POST /1/user/-/activities/goals/{period}.json Update Activity Goals
ActivityApi delete_activities_log DELETE /1/user/-/activities/{activity-log-id}.json Delete Activity Log
ActivityApi delete_favorite_activities DELETE /1/user/-/activities/favorite/{activity-id}.json Delete Favorite Activity
ActivityApi get_activities_by_date GET /1/user/-/activities/date/{date}.json Get Activity Summary by Date
ActivityApi get_activities_goals GET /1/user/-/activities/goals/{period}.json Get Activity Goals
ActivityApi get_activities_log GET /1/user/-/activities.json Get Lifetime Stats
ActivityApi get_activities_log_list GET /1/user/-/activities/list.json Get Activity Log List
ActivityApi get_activities_tcx GET /1/user/-/activities/{log-id}.tcx Get Activity TCX
ActivityApi get_activities_type_detail GET /1/activities/{activity-id}.json Get Activity Type
ActivityApi get_activities_types GET /1/activities.json Browse Activity Types
ActivityApi get_favorite_activities GET /1/user/-/activities/favorite.json Get Favorite Activities
ActivityApi get_frequent_activities GET /1/user/-/activities/frequent.json Get Frequent Activities
ActivityApi get_recent_activities GET /1/user/-/activities/recent.json Get Recent Activity Types
ActivityIntradayTimeSeriesApi get_activities_resource_by_date_intraday GET /1/user/-/activities/{resource-path}/date/{date}/1d/{detail-level}.json Get Intraday Time Series
ActivityIntradayTimeSeriesApi get_activities_resource_by_date_range_intraday GET /1/user/-/activities/{resource-path}/date/{base-date}/{end-date}/{detail-level}.json Get Activity Intraday Time Series
ActivityIntradayTimeSeriesApi get_activities_resource_by_date_range_time_series_intraday GET /1/user/-/activities/{resource-path}/date/{date}/{end-date}/{detail-level}/time/{start-time}/{end-time}.json Get Activity Intraday Time Series
ActivityIntradayTimeSeriesApi get_activities_resource_by_date_time_series_intraday GET /1/user/-/activities/{resource-path}/date/{date}/1d/{detail-level}/time/{start-time}/{end-time}.json Get Intraday Time Series
ActivityTimeSeriesApi get_activities_resource_by_date_period GET /1/user/-/activities/{resource-path}/date/{date}/{period}.json Get Activity Time Series
ActivityTimeSeriesApi get_activities_resource_by_date_range GET /1/user/-/activities/{resource-path}/date/{base-date}/{end-date}.json Get Activity Resource by Date Range
ActivityTimeSeriesApi get_activities_tracker_resource_by_date_period GET /1/user/-/activities/tracker/{resource-path}/date/{date}/{period}.json Get Activity Time Series
ActivityTimeSeriesApi get_activities_tracker_resource_by_date_range GET /1/user/-/activities/tracker/{resource-path}/date/{base-date}/{end-date}.json Get Activity Tracker Resource by Date Range Time Series
AuthorizationApi introspect POST /1.1/oauth2/introspect Retrieve the active state of an OAuth 2.0 token
AuthorizationApi oauth_token POST /oauth2/token Get OAuth 2 access token
AuthorizationApi revoke POST /oauth2/revoke Revokes consent of the access token or refresh token
BodyApi add_body_fat_log POST /1/user/-/body/log/fat.json Log Body Fat
BodyApi add_weight_log POST /1/user/-/body/log/weight.json Log Weight
BodyApi delete_body_fat_log DELETE /1/user/-/body/log/fat/{body-fat-log-id}.json Delete Body Fat Log
BodyApi delete_weight_log DELETE /1/user/-/body/log/weight/{body-weight-log-id}.json Delete Weight Log
BodyApi get_body_fat_by_date GET /1/user/-/body/log/fat/date/{date}.json Get Body Fat Logs
BodyApi get_body_fat_by_date_period GET /1/user/-/body/log/fat/date/{date}/{period}.json Get Body Fat Logs
BodyApi get_body_fat_by_date_range GET /1/user/-/body/log/fat/date/{base-date}/{end-date}.json Get Body Fat Logs
BodyApi get_body_goals GET /1/user/-/body/log/{goal-type}/goal.json Get Body Goals
BodyApi get_weight_by_date GET /1/user/-/body/log/weight/date/{date}.json Get Weight Logs
BodyApi get_weight_by_date_period GET /1/user/-/body/log/weight/date/{date}/{period}.json Get Body Fat Logs
BodyApi get_weight_by_date_range GET /1/user/-/body/log/weight/date/{base-date}/{end-date}.json Get Body Fat Logs
BodyApi update_body_fat_goal POST /1/user/-/body/log/fat/goal.json Update Body Fat Goal
BodyApi update_weight_goal POST /1/user/-/body/log/weight/goal.json Update Weight Goal
BodyTimeSeriesApi get_body_resource_by_date_period GET /1/user/-/body/{resource-path}/date/{date}/{period}.json Get Body Time Series
BodyTimeSeriesApi get_body_resource_by_date_range GET /1/user/-/body/{resource-path}/date/{base-date}/{end-date}.json Get Body Time Series
BreathingRateApi get_breathing_rate_summary_by_date GET /1/user/-/br/date/{date}.json Get Breathing Rate Summary by Date
BreathingRateApi get_breathing_rate_summary_by_interval GET /1/user/-/br/date/{startDate}/{endDate}.json Get Breathing Rate Summary by Interval
BreathingRateIntradayApi get_breathing_rate_intraday_by_date GET /1/user/-/br/date/{date}/all.json Get Breathing Rate Intraday by Date
BreathingRateIntradayApi get_breathing_rate_intraday_by_interval GET /1/user/-/br/date/{startDate}/{endDate}/all.json Get Breathing Rate Intraday by Interval
CardioFitnessScoreVO2MaxApi get_vo2_max_summary_by_date GET /1/user/-/cardioscore/date/{date}.json Get VO2 Max Summary by Date
CardioFitnessScoreVO2MaxApi get_vo2_max_summary_by_interval GET /1/user/-/cardioscore/date/{startDate}/{endDate}.json Get VO2 Max Summary by Interval
DevicesApi add_alarms POST /1/user/-/devices/tracker/{tracker-id}/alarms.json Add Alarm
DevicesApi delete_alarms DELETE /1/user/-/devices/tracker/{tracker-id}/alarms/{alarm-id}.json Delete Alarm
DevicesApi get_alarms GET /1/user/-/devices/tracker/{tracker-id}/alarms.json Get Alarms
DevicesApi get_devices GET /1/user/-/devices.json Get Devices
DevicesApi update_alarms POST /1/user/-/devices/tracker/{tracker-id}/alarms/{alarm-id}.json Update Alarm
ElectrocardiogramApi get_ecg_log_list GET /1/user/-/ecg/list.json Get ECG Log List
FriendsApi get_friends GET /1.1/user/-/friends.json Get Friends
FriendsApi get_friends_leaderboard GET /1.1/user/-/leaderboard/friends.json Get Friends Leaderboard
HeartRateIntradayTimeSeriesApi get_heart_by_date_intraday GET /1/user/-/activities/heart/date/{date}/1d/{detail-level}.json Get Heart Rate Intraday Time Series
HeartRateIntradayTimeSeriesApi get_heart_by_date_range_intraday GET /1/user/-/activities/heart/date/{date}/{end-date}/{detail-level}.json Get Heart Rate Intraday Time Series
HeartRateIntradayTimeSeriesApi get_heart_by_date_range_timestamp_intraday GET /1/user/-/activities/heart/date/{date}/{end-date}/{detail-level}/time/{start-time}/{end-time}.json Get Heart Rate Intraday Time Series
HeartRateIntradayTimeSeriesApi get_heart_by_date_timestamp_intraday GET /1/user/-/activities/heart/date/{date}/1d/{detail-level}/time/{start-time}/{end-time}.json Get Heart Rate Intraday Time Series
HeartRateTimeSeriesApi get_heart_by_date_period GET /1/user/-/activities/heart/date/{date}/{period}.json Get Heart Rate Time Series
HeartRateTimeSeriesApi get_heart_by_date_range GET /1/user/-/activities/heart/date/{base-date}/{end-date}.json Get Heart Rate Time Series
HeartRateVariabilityApi get_hrv_summary_date GET /1/user/-/hrv/date/{date}.json Get HRV Summary by Date
HeartRateVariabilityApi get_hrv_summary_interval GET /1/user/-/hrv/date/{startDate}/{endDate}.json Get HRV Summary by Interval
HeartRateVariabilityIntradayApi get_hrv_intraday_by_date GET /1/user/-/hrv/date/{date}/all.json Get HRV Intraday by Date
HeartRateVariabilityIntradayApi get_hrv_intraday_by_interval GET /1/user/-/hrv/date/{startDate}/{endDate}/all.json Get HRV Intraday by Interval
NutritionApi add_favorite_food POST /1/user/-/foods/log/favorite/{food-id}.json Add Favorite Food
NutritionApi add_foods POST /1/user/-/foods.json Create Food
NutritionApi add_foods_log POST /1/user/-/foods/log.json Log Food
NutritionApi add_meal POST /1/user/-/meals.json Create Meal
NutritionApi add_update_foods_goal POST /1/user/-/foods/log/goal.json Update Food Goal
NutritionApi add_update_water_goal POST /1/user/-/foods/log/water/goal.json Update Water Goal
NutritionApi add_water_log POST /1/user/-/foods/log/water.json Log Water
NutritionApi delete_favorite_food DELETE /1/user/-/foods/log/favorite/{food-id}.json Delete Favorite Food
NutritionApi delete_foods DELETE /1/user/-/foods/{food-id}.json Delete Custom Food
NutritionApi delete_foods_log DELETE /1/user/-/foods/log/{food-log-id}.json Delete Food Log
NutritionApi delete_meal DELETE /1/user/-/meals/{meal-id}.json Delete Meal
NutritionApi delete_water_log DELETE /1/user/-/foods/log/water/{water-log-id}.json Delete Water Log
NutritionApi edit_foods_log POST /1/user/-/foods/log/{food-log-id}.json Edit Food Log
NutritionApi get_favorite_foods GET /1/user/-/foods/log/favorite.json Get Favorite Foods
NutritionApi get_foods_by_date GET /1/user/-/foods/log/date/{date}.json Get Food Logs
NutritionApi get_foods_goal GET /1/user/-/foods/log/goal.json Get Food Goals
NutritionApi get_foods_info GET /1/foods/{food-id}.json Get Food
NutritionApi get_foods_list GET /1/foods/search.json Search Foods
NutritionApi get_foods_locales GET /1/foods/locales.json Get Food Locales
NutritionApi get_foods_units GET /1/foods/units.json Get Food Units
NutritionApi get_frequent_foods GET /1/user/-/foods/log/frequent.json Get Frequent Foods
NutritionApi get_meals GET /1/user/-/meals.json Get Meals
NutritionApi get_recent_foods GET /1/user/-/foods/log/recent.json Get Recent Foods
NutritionApi get_water_by_date GET /1/user/-/foods/log/water/date/{date}.json Get Water Logs
NutritionApi get_water_goal GET /1/user/-/foods/log/water/goal.json Get Water Goal
NutritionApi update_meal POST /1/user/-/meals/{meal-id}.json Update Meal
NutritionApi update_water_log POST /1/user/-/foods/log/water/{water-log-id}.json Update Water Log
NutritionTimeSeriesApi get_foods_by_date_range GET /1/user/-/foods/log/{resource-path}/date/{base-date}/{end-date}.json Get Food or Water Time Series
NutritionTimeSeriesApi get_foods_resource_by_date_period GET /1/user/-/foods/log/{resource-path}/date/{date}/{period}.json Get Food or Water Time Series
SleepApi add_sleep POST /1.2/user/-/sleep.json Log Sleep
SleepApi delete_sleep DELETE /1.2/user/-/sleep/{log-id}.json Delete Sleep Log
SleepApi get_sleep_by_date GET /1.2/user/-/sleep/date/{date}.json Get Sleep Log
SleepApi get_sleep_by_date_range GET /1.2/user/-/sleep/date/{base-date}/{end-date}.json Get Sleep Logs by Date Range
SleepApi get_sleep_goal GET /1.2/user/-/sleep/goal.json Get Sleep Goal
SleepApi get_sleep_list GET /1.2/user/-/sleep/list.json Get Sleep Logs List
SleepApi update_sleep_goal POST /1.2/user/-/sleep/goal.json Update Sleep Goal
SpO2Api get_sp_o2_summary_by_date GET /1/user/-/spo2/date/{date}.json Get SpO2 Summary by Date
SpO2Api get_sp_o2_summary_by_interval GET /1/user/-/spo2/date/{startDate}/{endDate}.json Get SpO2 Summary by Interval
SpO2IntradayApi get_sp_o2_intraday_by_date GET /1/user/-/spo2/date/{date}/all.json Get SpO2 Intraday by Date
SpO2IntradayApi get_sp_o2_intraday_by_interval GET /1/user/-/spo2/date/{startDate}/{endDate}/all.json Get SpO2 Intraday by Interval
SubscriptionsApi add_subscriptions POST /1/user/-/{collection-path}/apiSubscriptions/{subscription-id}.json Add a Subscription
SubscriptionsApi delete_subscriptions DELETE /1/user/-/{collection-path}/apiSubscriptions/{subscription-id}.json Delete a Subscription
SubscriptionsApi get_subscriptions_list GET /1/user/-/{collection-path}/apiSubscriptions.json Get a List of Subscriptions
TemperatureApi get_temp_core_summary_by_date GET /1/user/-/temp/core/date/{date}.json Get Temperature (Core) Summary by Date
TemperatureApi get_temp_core_summary_by_interval GET /1/user/-/temp/core/date/{startDate}/{endDate}.json Get Temperature (Core) Summary by Interval
TemperatureApi get_temp_skin_summary_by_interval GET /1/user/-/temp/skin/date/{startDate}/{endDate}.json Get Temperature (Skin) Summary by Interval
TemperatureApi get_temp_skin_summary_date GET /1/user/-/temp/skin/date/{date}.json Get Temperature (Skin) Summary by Date
UserApi get_badges GET /1/user/-/badges.json Get Badges
UserApi get_profile GET /1/user/-/profile.json Get Profile
UserApi update_profile POST /1/user/-/profile.json Update Profile

Documentation For Models

Documentation For Authorization

oauth2

  • Type: OAuth
  • Flow: implicit
  • Authorization URL: https://www.fitbit.com/oauth2/authorize
  • Scopes:
  • activity: Activity data and exercise log related features, such as steps, distance, calories burned, and active minutes
  • cardio_fitness: Maximum or optimum rate at which the user’s heart, lungs, and muscles can effectively use oxygen during exercise
  • electrocardiogram: A users on-device ECG readings
  • heartrate: Continuous heart rate & HRV data and related analysis
  • location: GPS and other location data
  • nutrition: Calorie consumption and nutrition related features, such as food/water logging, goals, and plans
  • oxygen_saturation: SpO2 (Oxygen Saturation) is a measurement of your blood oxygen level
  • profile: Basic user information
  • respiratory_rate: Respiratory Rate is a measurement of your breaths at night.
  • settings: User account and device settings, such as alarms
  • sleep: Sleep logs and related sleep analysis
  • social: Friend-related features, such as friend list and leaderboard
  • temperature: Core and skin temperature data
  • weight: Weight and related information, such as body mass index, body fat percentage, and goals

Author