fitbit_web_api.ActivityApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ----------------------------------------------------------------------------- | ----------------------------------------------------------- | ---------------------------- |
| [**add_activities_log**](ActivityApi.mdadd_activities_log) | **POST** /1/user/-/activities.json | Log Activity |
| [**add_favorite_activities**](ActivityApi.mdadd_favorite_activities) | **POST** /1/user/-/activities/favorite/{activity-id}.json | Add Favorite Activity |
| [**add_update_activities_goals**](ActivityApi.mdadd_update_activities_goals) | **POST** /1/user/-/activities/goals/{period}.json | Update Activity Goals |
| [**delete_activities_log**](ActivityApi.mddelete_activities_log) | **DELETE** /1/user/-/activities/{activity-log-id}.json | Delete Activity Log |
| [**delete_favorite_activities**](ActivityApi.mddelete_favorite_activities) | **DELETE** /1/user/-/activities/favorite/{activity-id}.json | Delete Favorite Activity |
| [**get_activities_by_date**](ActivityApi.mdget_activities_by_date) | **GET** /1/user/-/activities/date/{date}.json | Get Activity Summary by Date |
| [**get_activities_goals**](ActivityApi.mdget_activities_goals) | **GET** /1/user/-/activities/goals/{period}.json | Get Activity Goals |
| [**get_activities_log**](ActivityApi.mdget_activities_log) | **GET** /1/user/-/activities.json | Get Lifetime Stats |
| [**get_activities_log_list**](ActivityApi.mdget_activities_log_list) | **GET** /1/user/-/activities/list.json | Get Activity Log List |
| [**get_activities_tcx**](ActivityApi.mdget_activities_tcx) | **GET** /1/user/-/activities/{log-id}.tcx | Get Activity TCX |
| [**get_activities_type_detail**](ActivityApi.mdget_activities_type_detail) | **GET** /1/activities/{activity-id}.json | Get Activity Type |
| [**get_activities_types**](ActivityApi.mdget_activities_types) | **GET** /1/activities.json | Browse Activity Types |
| [**get_favorite_activities**](ActivityApi.mdget_favorite_activities) | **GET** /1/user/-/activities/favorite.json | Get Favorite Activities |
| [**get_frequent_activities**](ActivityApi.mdget_frequent_activities) | **GET** /1/user/-/activities/frequent.json | Get Frequent Activities |
| [**get_recent_activities**](ActivityApi.mdget_recent_activities) | **GET** /1/user/-/activities/recent.json | Get Recent Activity Types |
**add_activities_log**
> add_activities_log(activity_id, manual_calories, start_time, duration_millis, \_date, distance, activity_name=activity_name, distance_unit=distance_unit)
Log Activity
The Log Activity endpoint creates log entry for an activity or user's private custom activity using units in the unit system which corresponds to the Accept-Language header provided (or using optional custom distanceUnit) and get a response in the format requested.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_id = 56 int | The ID of the activity, directory activity or intensity level activity.
manual_calories = 56 int | Calories burned that are manaully specified. Required with activityName must be provided.
start_time = 'start_time_example' str | Activity start time. Hours and minutes in the format HH:mm:ss.
duration_millis = 56 int | Duration in milliseconds.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
distance = 56 int | Distance is required for logging directory activity in the format X.XX and in the selected distanceUnit.
activity_name = 'activity_name_example' str | Custom activity name. Either activityId or activityName must be provided. (optional)
distance_unit = 56 int | Distance measurement unit. Steps units are available only for Walking (activityId=90013) and Running (activityId=90009) directory activities and their intensity levels. (optional)
try:
Log Activity
api_instance.add_activities_log(activity_id, manual_calories, start_time, duration_millis, _date, distance, activity_name=activity_name, distance_unit=distance_unit)
except ApiException as e:
print("Exception when calling ActivityApi->add_activities_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **activity_id** | **int** | The ID of the activity, directory activity or intensity level activity. |
| **manual_calories** | **int** | Calories burned that are manaully specified. Required with activityName must be provided. |
| **start_time** | **str** | Activity start time. Hours and minutes in the format HH:mm:ss. |
| **duration_millis** | **int** | Duration in milliseconds. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **distance** | **int** | Distance is required for logging directory activity in the format X.XX and in the selected distanceUnit. |
| **activity_name** | **str** | Custom activity name. Either activityId or activityName must be provided. | [optional] |
| **distance_unit** | **int** | Distance measurement unit. Steps units are available only for Walking (activityId&x3D;90013) and Running (activityId&x3D;90009) directory activities and their intensity levels. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_favorite_activities**
> add_favorite_activities(activity_id)
Add Favorite Activity
Adds the activity with the given ID to user's list of favorite activities.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_id = 'activity_id_example' str | The encoded ID of the activity.
try:
Add Favorite Activity
api_instance.add_favorite_activities(activity_id)
except ApiException as e:
print("Exception when calling ActivityApi->add_favorite_activities: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ------------------------------- | ----- |
| **activity_id** | **str** | The encoded ID of the activity. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_activities_goals**
> add_update_activities_goals(period, type, value)
Update Activity Goals
Updates a user's daily or weekly activity goals and returns a response using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
period = 'period_example' str | daily or weekly.
type = 'type_example' str | goal type
value = 'value_example' str | goal value
try:
Update Activity Goals
api_instance.add_update_activities_goals(period, type, value)
except ApiException as e:
print("Exception when calling ActivityApi->add_update_activities_goals: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | ------- | ---------------- | ----- |
| **period** | **str** | daily or weekly. |
| **type** | **str** | goal type |
| **value** | **str** | goal value |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_activities_log**
> delete_activities_log(activity_log_id)
Delete Activity Log
Deletes a user's activity log entry with the given ID.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_log_id = 56 int | The id of the activity log entry.
try:
Delete Activity Log
api_instance.delete_activities_log(activity_log_id)
except ApiException as e:
print("Exception when calling ActivityApi->delete_activities_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------- | ------- | --------------------------------- | ----- |
| **activity_log_id** | **int** | The id of the activity log entry. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_favorite_activities**
> delete_favorite_activities(activity_id)
Delete Favorite Activity
Removes the activity with the given ID from a user's list of favorite activities.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_id = 'activity_id_example' str | The ID of the activity to be removed.
try:
Delete Favorite Activity
api_instance.delete_favorite_activities(activity_id)
except ApiException as e:
print("Exception when calling ActivityApi->delete_favorite_activities: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ------------------------------------- | ----- |
| **activity_id** | **str** | The ID of the activity to be removed. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_by_date**
> get_activities_by_date(\_date)
Get Activity Summary by Date
Retrieves a summary and list of a user's activities and activity log entries for a given day.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd
try:
Get Activity Summary by Date
api_instance.get_activities_by_date(_date)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | --------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_goals**
> get_activities_goals(period)
Get Activity Goals
Retreives a user's current daily or weekly activity goals using measurement units as defined in the unit system, which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
period = 'period_example' str | daily or weekly.
try:
Get Activity Goals
api_instance.get_activities_goals(period)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_goals: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | ------- | ---------------- | ----- |
| **period** | **str** | daily or weekly. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_log**
> get_activities_log()
Get Lifetime Stats
Updates a user's daily activity goals and returns a response using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Get Lifetime Stats
api_instance.get_activities_log()
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_log: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_log_list**
> get_activities_log_list(sort, offset, limit, before_date=before_date, after_date=after_date)
Get Activity Log List
Retreives a list of user's activity log entries before or after a given day with offset and limit using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
sort = 'sort_example' str | The sort order of entries by date asc (ascending) or desc (descending).
offset = 0 int | The offset number of entries. (default to 0)
limit = 56 int | The maximum number of entries returned (maximum;100).
before_date = '2013-10-20' date | The date in the format yyyy-MM-ddTHH:mm:ss. Only yyyy-MM-dd is required. Either beforeDate or afterDate should be specified. (optional)
after_date = '2013-10-20' date | The date in the format yyyy-MM-ddTHH:mm:ss. (optional)
try:
Get Activity Log List
api_instance.get_activities_log_list(sort, offset, limit, before_date=before_date, after_date=after_date)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_log_list: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- | -------------- |
| **sort** | **str** | The sort order of entries by date asc (ascending) or desc (descending). |
| **offset** | **int** | The offset number of entries. | [default to 0] |
| **limit** | **int** | The maximum number of entries returned (maximum;100). |
| **before_date** | **date** | The date in the format yyyy-MM-ddTHH:mm:ss. Only yyyy-MM-dd is required. Either beforeDate or afterDate should be specified. | [optional] |
| **after_date** | **date** | The date in the format yyyy-MM-ddTHH:mm:ss. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_tcx**
> get_activities_tcx(log_id, include_partial_tcx=include_partial_tcx)
Get Activity TCX
Retreives the details of a user's location and heart rate data during a logged exercise activity.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
log_id = 'log_id_example' str | The activity's log ID.
include_partial_tcx = true bool | Include TCX points regardless of GPS data being present (optional)
try:
Get Activity TCX
api_instance.get_activities_tcx(log_id, include_partial_tcx=include_partial_tcx)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_tcx: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------------------- | -------- | ------------------------------------------------------- | ---------- |
| **log_id** | **str** | The activity&x27;s log ID. |
| **include_partial_tcx** | **bool** | Include TCX points regardless of GPS data being present | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_type_detail**
> get_activities_type_detail(activity_id)
Get Activity Type
Returns the detail of a specific activity in the Fitbit activities database in the format requested. If activity has levels, it also returns a list of activity level details.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_id = 'activity_id_example' str | The activity ID.
try:
Get Activity Type
api_instance.get_activities_type_detail(activity_id)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_type_detail: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ---------------- | ----- |
| **activity_id** | **str** | The activity ID. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_types**
> get_activities_types()
Browse Activity Types
Retreives a tree of all valid Fitbit public activities from the activities catelog as well as private custom activities the user created in the format requested.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Browse Activity Types
api_instance.get_activities_types()
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_types: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_favorite_activities**
> get_favorite_activities()
Get Favorite Activities
Returns a list of a user's favorite activities.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Get Favorite Activities
api_instance.get_favorite_activities()
except ApiException as e:
print("Exception when calling ActivityApi->get_favorite_activities: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_frequent_activities**
> get_frequent_activities()
Get Frequent Activities
Retreives a list of a user's frequent activities in the format requested using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Get Frequent Activities
api_instance.get_frequent_activities()
except ApiException as e:
print("Exception when calling ActivityApi->get_frequent_activities: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_recent_activities**
> get_recent_activities()
Get Recent Activity Types
Retreives a list of a user's recent activities types logged with some details of the last activity log of that type using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Get Recent Activity Types
api_instance.get_recent_activities()
except ApiException as e:
print("Exception when calling ActivityApi->get_recent_activities: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
fitbit_web_api.NutritionApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ------------------------------------------------------------------ | -------------------------------------------------------- | -------------------- |
| [**add_favorite_food**](NutritionApi.mdadd_favorite_food) | **POST** /1/user/-/foods/log/favorite/{food-id}.json | Add Favorite Food |
| [**add_foods**](NutritionApi.mdadd_foods) | **POST** /1/user/-/foods.json | Create Food |
| [**add_foods_log**](NutritionApi.mdadd_foods_log) | **POST** /1/user/-/foods/log.json | Log Food |
| [**add_meal**](NutritionApi.mdadd_meal) | **POST** /1/user/-/meals.json | Create Meal |
| [**add_update_foods_goal**](NutritionApi.mdadd_update_foods_goal) | **POST** /1/user/-/foods/log/goal.json | Update Food Goal |
| [**add_update_water_goal**](NutritionApi.mdadd_update_water_goal) | **POST** /1/user/-/foods/log/water/goal.json | Update Water Goal |
| [**add_water_log**](NutritionApi.mdadd_water_log) | **POST** /1/user/-/foods/log/water.json | Log Water |
| [**delete_favorite_food**](NutritionApi.mddelete_favorite_food) | **DELETE** /1/user/-/foods/log/favorite/{food-id}.json | Delete Favorite Food |
| [**delete_foods**](NutritionApi.mddelete_foods) | **DELETE** /1/user/-/foods/{food-id}.json | Delete Custom Food |
| [**delete_foods_log**](NutritionApi.mddelete_foods_log) | **DELETE** /1/user/-/foods/log/{food-log-id}.json | Delete Food Log |
| [**delete_meal**](NutritionApi.mddelete_meal) | **DELETE** /1/user/-/meals/{meal-id}.json | Delete Meal |
| [**delete_water_log**](NutritionApi.mddelete_water_log) | **DELETE** /1/user/-/foods/log/water/{water-log-id}.json | Delete Water Log |
| [**edit_foods_log**](NutritionApi.mdedit_foods_log) | **POST** /1/user/-/foods/log/{food-log-id}.json | Edit Food Log |
| [**get_favorite_foods**](NutritionApi.mdget_favorite_foods) | **GET** /1/user/-/foods/log/favorite.json | Get Favorite Foods |
| [**get_foods_by_date**](NutritionApi.mdget_foods_by_date) | **GET** /1/user/-/foods/log/date/{date}.json | Get Food Logs |
| [**get_foods_goal**](NutritionApi.mdget_foods_goal) | **GET** /1/user/-/foods/log/goal.json | Get Food Goals |
| [**get_foods_info**](NutritionApi.mdget_foods_info) | **GET** /1/foods/{food-id}.json | Get Food |
| [**get_foods_list**](NutritionApi.mdget_foods_list) | **GET** /1/foods/search.json | Search Foods |
| [**get_foods_locales**](NutritionApi.mdget_foods_locales) | **GET** /1/foods/locales.json | Get Food Locales |
| [**get_foods_units**](NutritionApi.mdget_foods_units) | **GET** /1/foods/units.json | Get Food Units |
| [**get_frequent_foods**](NutritionApi.mdget_frequent_foods) | **GET** /1/user/-/foods/log/frequent.json | Get Frequent Foods |
| [**get_meals**](NutritionApi.mdget_meals) | **GET** /1/user/-/meals.json | Get Meals |
| [**get_recent_foods**](NutritionApi.mdget_recent_foods) | **GET** /1/user/-/foods/log/recent.json | Get Recent Foods |
| [**get_water_by_date**](NutritionApi.mdget_water_by_date) | **GET** /1/user/-/foods/log/water/date/{date}.json | Get Water Logs |
| [**get_water_goal**](NutritionApi.mdget_water_goal) | **GET** /1/user/-/foods/log/water/goal.json | Get Water Goal |
| [**update_meal**](NutritionApi.mdupdate_meal) | **POST** /1/user/-/meals/{meal-id}.json | Update Meal |
| [**update_water_log**](NutritionApi.mdupdate_water_log) | **POST** /1/user/-/foods/log/water/{water-log-id}.json | Update Water Log |
**add_favorite_food**
> add_favorite_food(food_id)
Add Favorite Food
Updates a user's daily activity goals and returns a response using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be added to user's favorites.
try:
Add Favorite Food
api_instance.add_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->add_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | -------------------------------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be added to user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods**
> add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
Create Food
Creates a new private food for a user and returns a response in the format requested. The created food is found via the Search Foods call.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
name = 'name_example' str | The food name.
default_food_measurement_unit_id = 'default_food_measurement_unit_id_example' str | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint.
default_serving_size = 'default_serving_size_example' str | The size of the default serving. Nutrition values should be provided for this serving size.
calories = 'calories_example' str | The calories in the default serving size.
form_type = 'form_type_example' str | Form type; LIQUID or DRY. (optional)
description = 'description_example' str | The description of the food. (optional)
try:
Create Food
api_instance.add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------ | ---------- |
| **name** | **str** | The food name. |
| **default_food_measurement_unit_id** | **str** | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint. |
| **default_serving_size** | **str** | The size of the default serving. Nutrition values should be provided for this serving size. |
| **calories** | **str** | The calories in the default serving size. |
| **form_type** | **str** | Form type; LIQUID or DRY. | [optional] |
| **description** | **str** | The description of the food. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods_log**
> add_foods_log(food_id, meal_type_id, unit_id, amount, \_date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
Log Food
Creates food log entries for users with or without foodId value.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be logged. Either foodId or foodName must be provided.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
food_name = 'food_name_example' str | Food entry name. Either foodId or foodName must be provided. (optional)
favorite = true bool | The `true` value will add the food to the user's favorites after creating the log entry; while the `false` value will not. Valid only with foodId value. (optional)
brand_name = 'brand_name_example' str | Brand name of food. Valid only with foodName parameters. (optional)
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Log Food
api_instance.add_foods_log(food_id, meal_type_id, unit_id, amount, _date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **food_id** | **str** | The ID of the food to be logged. Either foodId or foodName must be provided. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **food_name** | **str** | Food entry name. Either foodId or foodName must be provided. | [optional] |
| **favorite** | **bool** | The &x60;true&x60; value will add the food to the user&x27;s favorites after creating the log entry; while the &x60;false&x60; value will not. Valid only with foodId value. | [optional] |
| **brand_name** | **str** | Brand name of food. Valid only with foodName parameters. | [optional] |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_meal**
> add_meal(body)
Create Meal
Creates a meal with the given food contained in the post body.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Create Meal
api_instance.add_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->add_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_foods_goal**
> add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
Update Food Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
calories = 56 int | Manual calorie consumption goal in either calories or intensity must be provided.
intensity = 'intensity_example' str | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. (optional)
personalized = 'personalized_example' str | Food plan type; true or false. (optional)
try:
Update Food Goal
api_instance.add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_foods_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- | ---------- |
| **calories** | **int** | Manual calorie consumption goal in either calories or intensity must be provided. |
| **intensity** | **str** | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. | [optional] |
| **personalized** | **str** | Food plan type; true or false. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_water_goal**
> add_update_water_goal(target)
Update Water Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
target = 56 int | The target water goal in the format X.X is set in unit based on locale.
try:
Update Water Goal
api_instance.add_update_water_goal(target)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_water_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | ------- | ----------------------------------------------------------------------- | ----- |
| **target** | **int** | The target water goal in the format X.X is set in unit based on locale. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_water_log**
> add_water_log(\_date, amount, unit=unit)
Log Water
Creates a log entry for water using units in the unit systems that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned in the format yyyy-MM-dd.
amount = 56 int | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit; `ml`, `fl oz`, or `cup`. (optional)
try:
Log Water
api_instance.add_water_log(_date, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->add_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **\_date** | **date** | The date of records to be returned in the format yyyy-MM-dd. |
| **amount** | **int** | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit; &x60;ml&x60;, &x60;fl oz&x60;, or &x60;cup&x60;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_favorite_food**
> delete_favorite_food(food_id)
Delete Favorite Food
Deletes a food with the given ID to the user's list of favorite foods.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted from user's favorites.
try:
Delete Favorite Food
api_instance.delete_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------------------------------------------ | ----- |
| **food_id** | **str** | The ID of the food to be deleted from user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods**
> delete_foods(food_id)
Delete Custom Food
Deletes custom food for a user and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted.
try:
Delete Custom Food
api_instance.delete_foods(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | --------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods_log**
> delete_foods_log(food_log_id)
Delete Food Log
Deletes a user's food log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be deleted.
try:
Delete Food Log
api_instance.delete_foods_log(food_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ------------------------------------------- | ----- |
| **food_log_id** | **str** | The ID of the food log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_meal**
> delete_meal(meal_id)
Delete Meal
Deletes a user's meal with the given meal id.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
meal_id = 'meal_id_example' str | Id of the meal to delete.
try:
Delete Meal
api_instance.delete_meal(meal_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------- | ----- |
| **meal_id** | **str** | Id of the meal to delete. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_water_log**
> delete_water_log(water_log_id)
Delete Water Log
Deletes a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
try:
Delete Water Log
api_instance.delete_water_log(water_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------ | ----- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**edit_foods_log**
> edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
Edit Food Log
The Edit Food Log endpoint changes the quantity or calories consumed for a user's food log entry with the given Food Log ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be edited.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Edit Food Log
api_instance.edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->edit_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **food_log_id** | **str** | The ID of the food log entry to be edited. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_favorite_foods**
> get_favorite_foods()
Get Favorite Foods
Returns a list of a user's favorite foods in the format requested. A favorite food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Favorite Foods
api_instance.get_favorite_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_favorite_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_by_date**
> get_foods_by_date(\_date)
Get Food Logs
Retreives a summary and list of a user's food log entries for a given day in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Food Logs
api_instance.get_foods_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_goal**
> get_foods_goal()
Get Food Goals
Returns a user's current daily calorie consumption goal and/or foodPlan value in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Goals
api_instance.get_foods_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_info**
> get_foods_info(food_id)
Get Food
Returns the details of a specific food in the Fitbit food databases or a private food that an authorized user has entered in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food.
try:
Get Food
api_instance.get_foods_info(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_info: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------- | ----- |
| **food_id** | **str** | The ID of the food. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_list**
> get_foods_list(query)
Search Foods
Returns a list of public foods from the Fitbit food database and private food the user created in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
query = 'query_example' str | The URL-encoded search query.
try:
Search Foods
api_instance.get_foods_list(query)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_list: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------------------------- | ----- |
| **query** | **str** | The URL-encoded search query. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_locales**
> get_foods_locales()
Get Food Locales
Returns the food locales that the user may choose to search, log, and create food in.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Locales
api_instance.get_foods_locales()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_locales: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_units**
> get_foods_units()
Get Food Units
Returns a list of all valid Fitbit food units in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Units
api_instance.get_foods_units()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_units: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_frequent_foods**
> get_frequent_foods()
Get Frequent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Frequent Foods
api_instance.get_frequent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_frequent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_meals**
> get_meals()
Get Meals
Returns a list of meals created by user in the user's food log in the format requested. User creates and manages meals on the Food Log tab on the website.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Meals
api_instance.get_meals()
except ApiException as e:
print("Exception when calling NutritionApi->get_meals: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_recent_foods**
> get_recent_foods()
Get Recent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Recent Foods
api_instance.get_recent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_recent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_by_date**
> get_water_by_date(\_date)
Get Water Logs
Retreives a summary and list of a user's water log entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Water Logs
api_instance.get_water_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_water_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_goal**
> get_water_goal()
Get Water Goal
Retreives a summary and list of a user's water goal entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Water Goal
api_instance.get_water_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_water_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_meal**
> update_meal(body)
Update Meal
Replaces an existing meal with the contents of the request. The response contains the updated meal.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Update Meal
api_instance.update_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->update_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_water_log**
> update_water_log(water_log_id, amount, unit=unit)
Update Water Log
Updates a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
amount = 'amount_example' str | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit. 'ml', 'fl oz', or 'cup'. (optional)
try:
Update Water Log
api_instance.update_water_log(water_log_id, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->update_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
| **amount** | **str** | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit. &x27;ml&x27;, &x27;fl oz&x27;, or &x27;cup&x27;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
fitbit_web_api.BodyApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------ | -------------------- |
| [**add_body_fat_log**](BodyApi.mdadd_body_fat_log) | **POST** /1/user/-/body/log/fat.json | Log Body Fat |
| [**add_weight_log**](BodyApi.mdadd_weight_log) | **POST** /1/user/-/body/log/weight.json | Log Weight |
| [**delete_body_fat_log**](BodyApi.mddelete_body_fat_log) | **DELETE** /1/user/-/body/log/fat/{body-fat-log-id}.json | Delete Body Fat Log |
| [**delete_weight_log**](BodyApi.mddelete_weight_log) | **DELETE** /1/user/-/body/log/weight/{body-weight-log-id}.json | Delete Weight Log |
| [**get_body_fat_by_date**](BodyApi.mdget_body_fat_by_date) | **GET** /1/user/-/body/log/fat/date/{date}.json | Get Body Fat Logs |
| [**get_body_fat_by_date_period**](BodyApi.mdget_body_fat_by_date_period) | **GET** /1/user/-/body/log/fat/date/{date}/{period}.json | Get Body Fat Logs |
| [**get_body_fat_by_date_range**](BodyApi.mdget_body_fat_by_date_range) | **GET** /1/user/-/body/log/fat/date/{base-date}/{end-date}.json | Get Body Fat Logs |
| [**get_body_goals**](BodyApi.mdget_body_goals) | **GET** /1/user/-/body/log/{goal-type}/goal.json | Get Body Goals |
| [**get_weight_by_date**](BodyApi.mdget_weight_by_date) | **GET** /1/user/-/body/log/weight/date/{date}.json | Get Weight Logs |
| [**get_weight_by_date_period**](BodyApi.mdget_weight_by_date_period) | **GET** /1/user/-/body/log/weight/date/{date}/{period}.json | Get Body Fat Logs |
| [**get_weight_by_date_range**](BodyApi.mdget_weight_by_date_range) | **GET** /1/user/-/body/log/weight/date/{base-date}/{end-date}.json | Get Body Fat Logs |
| [**update_body_fat_goal**](BodyApi.mdupdate_body_fat_goal) | **POST** /1/user/-/body/log/fat/goal.json | Update Body Fat Goal |
| [**update_weight_goal**](BodyApi.mdupdate_weight_goal) | **POST** /1/user/-/body/log/weight/goal.json | Update Weight Goal |
**add_body_fat_log**
> add_body_fat_log(fat, \_date, time)
Log Body Fat
Creates a log entry for body fat and returns a response in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
fat = 56 int | Body fat in the format of X.XX in the unit system that corresponds to the Accept-Language header provided.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
time = 'time_example' str | Time of the measurement in hours and minutes in the format HH:mm:ss that is set to the last second of the day if not provided.
try:
Log Body Fat
api_instance.add_body_fat_log(fat, _date, time)
except ApiException as e:
print("Exception when calling BodyApi->add_body_fat_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ | ----- |
| **fat** | **int** | Body fat in the format of X.XX in the unit system that corresponds to the Accept-Language header provided. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **time** | **str** | Time of the measurement in hours and minutes in the format HH:mm:ss that is set to the last second of the day if not provided. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_weight_log**
> add_weight_log(weight, \_date, time=time)
Log Weight
Creates log entry for a body weight using units in the unit systems that corresponds to the Accept-Language header provided and gets a response in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
weight = 56 int | Weight in the format of X.XX.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
time = 'time_example' str | Time of the measurement; hours and minutes in the format of HH:mm:ss, which is set to the last second of the day if not provided. (optional)
try:
Log Weight
api_instance.add_weight_log(weight, _date, time=time)
except ApiException as e:
print("Exception when calling BodyApi->add_weight_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **weight** | **int** | Weight in the format of X.XX. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **time** | **str** | Time of the measurement; hours and minutes in the format of HH:mm:ss, which is set to the last second of the day if not provided. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_body_fat_log**
> delete_body_fat_log(body_fat_log_id)
Delete Body Fat Log
Deletes a user's body fat log entry with the given ID.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
body_fat_log_id = 56 int | The ID of the body fat log entry.
try:
Delete Body Fat Log
api_instance.delete_body_fat_log(body_fat_log_id)
except ApiException as e:
print("Exception when calling BodyApi->delete_body_fat_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------- | ------- | --------------------------------- | ----- |
| **body_fat_log_id** | **int** | The ID of the body fat log entry. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_weight_log**
> delete_weight_log(body_weight_log_id)
Delete Weight Log
Deletes a user's body weight log entrywith the given ID.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
body_weight_log_id = 56 int | The ID of the body weight log entry.
try:
Delete Weight Log
api_instance.delete_weight_log(body_weight_log_id)
except ApiException as e:
print("Exception when calling BodyApi->delete_weight_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------------- | ------- | ------------------------------------ | ----- |
| **body_weight_log_id** | **int** | The ID of the body weight log entry. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_fat_by_date**
> get_body_fat_by_date(\_date)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
try:
Get Body Fat Logs
api_instance.get_body_fat_by_date(_date)
except ApiException as e:
print("Exception when calling BodyApi->get_body_fat_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ---------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_fat_by_date_period**
> get_body_fat_by_date_period(\_date, period)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
period = 'period_example' str | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max.
try:
Get Body Fat Logs
api_instance.get_body_fat_by_date_period(_date, period)
except ApiException as e:
print("Exception when calling BodyApi->get_body_fat_by_date_period: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ----------------------------------------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
| **period** | **str** | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_fat_by_date_range**
> get_body_fat_by_date_range(base_date, end_date)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
base_date = '2013-10-20' date | The range start date in the format yyyy-MM-dd or today.
end_date = '2013-10-20' date | The end date of the range.
try:
Get Body Fat Logs
api_instance.get_body_fat_by_date_range(base_date, end_date)
except ApiException as e:
print("Exception when calling BodyApi->get_body_fat_by_date_range: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------- | -------- | ------------------------------------------------------- | ----- |
| **base_date** | **date** | The range start date in the format yyyy-MM-dd or today. |
| **end_date** | **date** | The end date of the range. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_goals**
> get_body_goals(goal_type)
Get Body Goals
Retreives a user's current body fat percentage or weight goal using units in the unit systems that corresponds to the Accept-Language header providedin the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
goal_type = 'goal_type_example' str | weight or fat.
try:
Get Body Goals
api_instance.get_body_goals(goal_type)
except ApiException as e:
print("Exception when calling BodyApi->get_body_goals: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------- | ------- | -------------- | ----- |
| **goal_type** | **str** | weight or fat. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_weight_by_date**
> get_weight_by_date(\_date)
Get Weight Logs
Retreives a list of all user's body weight log entries for a given day using units in the unit systems which corresponds to the Accept-Language header provided.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
try:
Get Weight Logs
api_instance.get_weight_by_date(_date)
except ApiException as e:
print("Exception when calling BodyApi->get_weight_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ---------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_weight_by_date_period**
> get_weight_by_date_period(\_date, period)
Get Body Fat Logs
Retreives a list of all user's body weight log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
period = 'period_example' str | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max.
try:
Get Body Fat Logs
api_instance.get_weight_by_date_period(_date, period)
except ApiException as e:
print("Exception when calling BodyApi->get_weight_by_date_period: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ----------------------------------------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
| **period** | **str** | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_weight_by_date_range**
> get_weight_by_date_range(base_date, end_date)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
base_date = '2013-10-20' date | The range start date in the format yyyy-MM-dd or today.
end_date = '2013-10-20' date | The end date of the range.
try:
Get Body Fat Logs
api_instance.get_weight_by_date_range(base_date, end_date)
except ApiException as e:
print("Exception when calling BodyApi->get_weight_by_date_range: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------- | -------- | ------------------------------------------------------- | ----- |
| **base_date** | **date** | The range start date in the format yyyy-MM-dd or today. |
| **end_date** | **date** | The end date of the range. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_body_fat_goal**
> update_body_fat_goal(fat)
Update Body Fat Goal
Updates user's fat percentage goal.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
fat = 'fat_example' str | Target body fat percentage; in the format X.XX.
try:
Update Body Fat Goal
api_instance.update_body_fat_goal(fat)
except ApiException as e:
print("Exception when calling BodyApi->update_body_fat_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------- | ------- | ----------------------------------------------- | ----- |
| **fat** | **str** | Target body fat percentage; in the format X.XX. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_weight_goal**
> update_weight_goal(start_date, start_weight, weight=weight)
Update Weight Goal
Updates user's fat percentage goal.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
start_date = 'start_date_example' str | Weight goal start date; in the format yyyy-MM-dd.
start_weight = 'start_weight_example' str | Weight goal start weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided.
weight = 'weight_example' str | Weight goal target weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided; required if user doesn't have an existing weight goal. (optional)
try:
Update Weight Goal
api_instance.update_weight_goal(start_date, start_weight, weight=weight)
except ApiException as e:
print("Exception when calling BodyApi->update_weight_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **start_date** | **str** | Weight goal start date; in the format yyyy-MM-dd. |
| **start_weight** | **str** | Weight goal start weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided. |
| **weight** | **str** | Weight goal target weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided; required if user doesn&x27;t have an existing weight goal. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
fitbit_web_api.ActivityApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ----------------------------------------------------------------------------- | ----------------------------------------------------------- | ---------------------------- |
| [**add_activities_log**](ActivityApi.mdadd_activities_log) | **POST** /1/user/-/activities.json | Log Activity |
| [**add_favorite_activities**](ActivityApi.mdadd_favorite_activities) | **POST** /1/user/-/activities/favorite/{activity-id}.json | Add Favorite Activity |
| [**add_update_activities_goals**](ActivityApi.mdadd_update_activities_goals) | **POST** /1/user/-/activities/goals/{period}.json | Update Activity Goals |
| [**delete_activities_log**](ActivityApi.mddelete_activities_log) | **DELETE** /1/user/-/activities/{activity-log-id}.json | Delete Activity Log |
| [**delete_favorite_activities**](ActivityApi.mddelete_favorite_activities) | **DELETE** /1/user/-/activities/favorite/{activity-id}.json | Delete Favorite Activity |
| [**get_activities_by_date**](ActivityApi.mdget_activities_by_date) | **GET** /1/user/-/activities/date/{date}.json | Get Activity Summary by Date |
| [**get_activities_goals**](ActivityApi.mdget_activities_goals) | **GET** /1/user/-/activities/goals/{period}.json | Get Activity Goals |
| [**get_activities_log**](ActivityApi.mdget_activities_log) | **GET** /1/user/-/activities.json | Get Lifetime Stats |
| [**get_activities_log_list**](ActivityApi.mdget_activities_log_list) | **GET** /1/user/-/activities/list.json | Get Activity Log List |
| [**get_activities_tcx**](ActivityApi.mdget_activities_tcx) | **GET** /1/user/-/activities/{log-id}.tcx | Get Activity TCX |
| [**get_activities_type_detail**](ActivityApi.mdget_activities_type_detail) | **GET** /1/activities/{activity-id}.json | Get Activity Type |
| [**get_activities_types**](ActivityApi.mdget_activities_types) | **GET** /1/activities.json | Browse Activity Types |
| [**get_favorite_activities**](ActivityApi.mdget_favorite_activities) | **GET** /1/user/-/activities/favorite.json | Get Favorite Activities |
| [**get_frequent_activities**](ActivityApi.mdget_frequent_activities) | **GET** /1/user/-/activities/frequent.json | Get Frequent Activities |
| [**get_recent_activities**](ActivityApi.mdget_recent_activities) | **GET** /1/user/-/activities/recent.json | Get Recent Activity Types |
**add_activities_log**
> add_activities_log(activity_id, manual_calories, start_time, duration_millis, \_date, distance, activity_name=activity_name, distance_unit=distance_unit)
Log Activity
The Log Activity endpoint creates log entry for an activity or user's private custom activity using units in the unit system which corresponds to the Accept-Language header provided (or using optional custom distanceUnit) and get a response in the format requested.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_id = 56 int | The ID of the activity, directory activity or intensity level activity.
manual_calories = 56 int | Calories burned that are manaully specified. Required with activityName must be provided.
start_time = 'start_time_example' str | Activity start time. Hours and minutes in the format HH:mm:ss.
duration_millis = 56 int | Duration in milliseconds.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
distance = 56 int | Distance is required for logging directory activity in the format X.XX and in the selected distanceUnit.
activity_name = 'activity_name_example' str | Custom activity name. Either activityId or activityName must be provided. (optional)
distance_unit = 56 int | Distance measurement unit. Steps units are available only for Walking (activityId=90013) and Running (activityId=90009) directory activities and their intensity levels. (optional)
try:
Log Activity
api_instance.add_activities_log(activity_id, manual_calories, start_time, duration_millis, _date, distance, activity_name=activity_name, distance_unit=distance_unit)
except ApiException as e:
print("Exception when calling ActivityApi->add_activities_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **activity_id** | **int** | The ID of the activity, directory activity or intensity level activity. |
| **manual_calories** | **int** | Calories burned that are manaully specified. Required with activityName must be provided. |
| **start_time** | **str** | Activity start time. Hours and minutes in the format HH:mm:ss. |
| **duration_millis** | **int** | Duration in milliseconds. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **distance** | **int** | Distance is required for logging directory activity in the format X.XX and in the selected distanceUnit. |
| **activity_name** | **str** | Custom activity name. Either activityId or activityName must be provided. | [optional] |
| **distance_unit** | **int** | Distance measurement unit. Steps units are available only for Walking (activityId&x3D;90013) and Running (activityId&x3D;90009) directory activities and their intensity levels. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_favorite_activities**
> add_favorite_activities(activity_id)
Add Favorite Activity
Adds the activity with the given ID to user's list of favorite activities.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_id = 'activity_id_example' str | The encoded ID of the activity.
try:
Add Favorite Activity
api_instance.add_favorite_activities(activity_id)
except ApiException as e:
print("Exception when calling ActivityApi->add_favorite_activities: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ------------------------------- | ----- |
| **activity_id** | **str** | The encoded ID of the activity. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_activities_goals**
> add_update_activities_goals(period, type, value)
Update Activity Goals
Updates a user's daily or weekly activity goals and returns a response using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
period = 'period_example' str | daily or weekly.
type = 'type_example' str | goal type
value = 'value_example' str | goal value
try:
Update Activity Goals
api_instance.add_update_activities_goals(period, type, value)
except ApiException as e:
print("Exception when calling ActivityApi->add_update_activities_goals: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | ------- | ---------------- | ----- |
| **period** | **str** | daily or weekly. |
| **type** | **str** | goal type |
| **value** | **str** | goal value |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_activities_log**
> delete_activities_log(activity_log_id)
Delete Activity Log
Deletes a user's activity log entry with the given ID.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_log_id = 56 int | The id of the activity log entry.
try:
Delete Activity Log
api_instance.delete_activities_log(activity_log_id)
except ApiException as e:
print("Exception when calling ActivityApi->delete_activities_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------- | ------- | --------------------------------- | ----- |
| **activity_log_id** | **int** | The id of the activity log entry. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_favorite_activities**
> delete_favorite_activities(activity_id)
Delete Favorite Activity
Removes the activity with the given ID from a user's list of favorite activities.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_id = 'activity_id_example' str | The ID of the activity to be removed.
try:
Delete Favorite Activity
api_instance.delete_favorite_activities(activity_id)
except ApiException as e:
print("Exception when calling ActivityApi->delete_favorite_activities: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ------------------------------------- | ----- |
| **activity_id** | **str** | The ID of the activity to be removed. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_by_date**
> get_activities_by_date(\_date)
Get Activity Summary by Date
Retrieves a summary and list of a user's activities and activity log entries for a given day.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd
try:
Get Activity Summary by Date
api_instance.get_activities_by_date(_date)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | --------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_goals**
> get_activities_goals(period)
Get Activity Goals
Retreives a user's current daily or weekly activity goals using measurement units as defined in the unit system, which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
period = 'period_example' str | daily or weekly.
try:
Get Activity Goals
api_instance.get_activities_goals(period)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_goals: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | ------- | ---------------- | ----- |
| **period** | **str** | daily or weekly. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_log**
> get_activities_log()
Get Lifetime Stats
Updates a user's daily activity goals and returns a response using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Get Lifetime Stats
api_instance.get_activities_log()
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_log: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_log_list**
> get_activities_log_list(sort, offset, limit, before_date=before_date, after_date=after_date)
Get Activity Log List
Retreives a list of user's activity log entries before or after a given day with offset and limit using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
sort = 'sort_example' str | The sort order of entries by date asc (ascending) or desc (descending).
offset = 0 int | The offset number of entries. (default to 0)
limit = 56 int | The maximum number of entries returned (maximum;100).
before_date = '2013-10-20' date | The date in the format yyyy-MM-ddTHH:mm:ss. Only yyyy-MM-dd is required. Either beforeDate or afterDate should be specified. (optional)
after_date = '2013-10-20' date | The date in the format yyyy-MM-ddTHH:mm:ss. (optional)
try:
Get Activity Log List
api_instance.get_activities_log_list(sort, offset, limit, before_date=before_date, after_date=after_date)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_log_list: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- | -------------- |
| **sort** | **str** | The sort order of entries by date asc (ascending) or desc (descending). |
| **offset** | **int** | The offset number of entries. | [default to 0] |
| **limit** | **int** | The maximum number of entries returned (maximum;100). |
| **before_date** | **date** | The date in the format yyyy-MM-ddTHH:mm:ss. Only yyyy-MM-dd is required. Either beforeDate or afterDate should be specified. | [optional] |
| **after_date** | **date** | The date in the format yyyy-MM-ddTHH:mm:ss. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_tcx**
> get_activities_tcx(log_id, include_partial_tcx=include_partial_tcx)
Get Activity TCX
Retreives the details of a user's location and heart rate data during a logged exercise activity.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
log_id = 'log_id_example' str | The activity's log ID.
include_partial_tcx = true bool | Include TCX points regardless of GPS data being present (optional)
try:
Get Activity TCX
api_instance.get_activities_tcx(log_id, include_partial_tcx=include_partial_tcx)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_tcx: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------------------- | -------- | ------------------------------------------------------- | ---------- |
| **log_id** | **str** | The activity&x27;s log ID. |
| **include_partial_tcx** | **bool** | Include TCX points regardless of GPS data being present | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_type_detail**
> get_activities_type_detail(activity_id)
Get Activity Type
Returns the detail of a specific activity in the Fitbit activities database in the format requested. If activity has levels, it also returns a list of activity level details.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
activity_id = 'activity_id_example' str | The activity ID.
try:
Get Activity Type
api_instance.get_activities_type_detail(activity_id)
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_type_detail: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ---------------- | ----- |
| **activity_id** | **str** | The activity ID. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_activities_types**
> get_activities_types()
Browse Activity Types
Retreives a tree of all valid Fitbit public activities from the activities catelog as well as private custom activities the user created in the format requested.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Browse Activity Types
api_instance.get_activities_types()
except ApiException as e:
print("Exception when calling ActivityApi->get_activities_types: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_favorite_activities**
> get_favorite_activities()
Get Favorite Activities
Returns a list of a user's favorite activities.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Get Favorite Activities
api_instance.get_favorite_activities()
except ApiException as e:
print("Exception when calling ActivityApi->get_favorite_activities: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_frequent_activities**
> get_frequent_activities()
Get Frequent Activities
Retreives a list of a user's frequent activities in the format requested using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Get Frequent Activities
api_instance.get_frequent_activities()
except ApiException as e:
print("Exception when calling ActivityApi->get_frequent_activities: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_recent_activities**
> get_recent_activities()
Get Recent Activity Types
Retreives a list of a user's recent activities types logged with some details of the last activity log of that type using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.ActivityApi(fitbit_web_api.ApiClient(configuration))
try:
Get Recent Activity Types
api_instance.get_recent_activities()
except ApiException as e:
print("Exception when calling ActivityApi->get_recent_activities: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
fitbit_web_api.NutritionApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ------------------------------------------------------------------ | -------------------------------------------------------- | -------------------- |
| [**add_favorite_food**](NutritionApi.mdadd_favorite_food) | **POST** /1/user/-/foods/log/favorite/{food-id}.json | Add Favorite Food |
| [**add_foods**](NutritionApi.mdadd_foods) | **POST** /1/user/-/foods.json | Create Food |
| [**add_foods_log**](NutritionApi.mdadd_foods_log) | **POST** /1/user/-/foods/log.json | Log Food |
| [**add_meal**](NutritionApi.mdadd_meal) | **POST** /1/user/-/meals.json | Create Meal |
| [**add_update_foods_goal**](NutritionApi.mdadd_update_foods_goal) | **POST** /1/user/-/foods/log/goal.json | Update Food Goal |
| [**add_update_water_goal**](NutritionApi.mdadd_update_water_goal) | **POST** /1/user/-/foods/log/water/goal.json | Update Water Goal |
| [**add_water_log**](NutritionApi.mdadd_water_log) | **POST** /1/user/-/foods/log/water.json | Log Water |
| [**delete_favorite_food**](NutritionApi.mddelete_favorite_food) | **DELETE** /1/user/-/foods/log/favorite/{food-id}.json | Delete Favorite Food |
| [**delete_foods**](NutritionApi.mddelete_foods) | **DELETE** /1/user/-/foods/{food-id}.json | Delete Custom Food |
| [**delete_foods_log**](NutritionApi.mddelete_foods_log) | **DELETE** /1/user/-/foods/log/{food-log-id}.json | Delete Food Log |
| [**delete_meal**](NutritionApi.mddelete_meal) | **DELETE** /1/user/-/meals/{meal-id}.json | Delete Meal |
| [**delete_water_log**](NutritionApi.mddelete_water_log) | **DELETE** /1/user/-/foods/log/water/{water-log-id}.json | Delete Water Log |
| [**edit_foods_log**](NutritionApi.mdedit_foods_log) | **POST** /1/user/-/foods/log/{food-log-id}.json | Edit Food Log |
| [**get_favorite_foods**](NutritionApi.mdget_favorite_foods) | **GET** /1/user/-/foods/log/favorite.json | Get Favorite Foods |
| [**get_foods_by_date**](NutritionApi.mdget_foods_by_date) | **GET** /1/user/-/foods/log/date/{date}.json | Get Food Logs |
| [**get_foods_goal**](NutritionApi.mdget_foods_goal) | **GET** /1/user/-/foods/log/goal.json | Get Food Goals |
| [**get_foods_info**](NutritionApi.mdget_foods_info) | **GET** /1/foods/{food-id}.json | Get Food |
| [**get_foods_list**](NutritionApi.mdget_foods_list) | **GET** /1/foods/search.json | Search Foods |
| [**get_foods_locales**](NutritionApi.mdget_foods_locales) | **GET** /1/foods/locales.json | Get Food Locales |
| [**get_foods_units**](NutritionApi.mdget_foods_units) | **GET** /1/foods/units.json | Get Food Units |
| [**get_frequent_foods**](NutritionApi.mdget_frequent_foods) | **GET** /1/user/-/foods/log/frequent.json | Get Frequent Foods |
| [**get_meals**](NutritionApi.mdget_meals) | **GET** /1/user/-/meals.json | Get Meals |
| [**get_recent_foods**](NutritionApi.mdget_recent_foods) | **GET** /1/user/-/foods/log/recent.json | Get Recent Foods |
| [**get_water_by_date**](NutritionApi.mdget_water_by_date) | **GET** /1/user/-/foods/log/water/date/{date}.json | Get Water Logs |
| [**get_water_goal**](NutritionApi.mdget_water_goal) | **GET** /1/user/-/foods/log/water/goal.json | Get Water Goal |
| [**update_meal**](NutritionApi.mdupdate_meal) | **POST** /1/user/-/meals/{meal-id}.json | Update Meal |
| [**update_water_log**](NutritionApi.mdupdate_water_log) | **POST** /1/user/-/foods/log/water/{water-log-id}.json | Update Water Log |
**add_favorite_food**
> add_favorite_food(food_id)
Add Favorite Food
Updates a user's daily activity goals and returns a response using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be added to user's favorites.
try:
Add Favorite Food
api_instance.add_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->add_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | -------------------------------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be added to user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods**
> add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
Create Food
Creates a new private food for a user and returns a response in the format requested. The created food is found via the Search Foods call.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
name = 'name_example' str | The food name.
default_food_measurement_unit_id = 'default_food_measurement_unit_id_example' str | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint.
default_serving_size = 'default_serving_size_example' str | The size of the default serving. Nutrition values should be provided for this serving size.
calories = 'calories_example' str | The calories in the default serving size.
form_type = 'form_type_example' str | Form type; LIQUID or DRY. (optional)
description = 'description_example' str | The description of the food. (optional)
try:
Create Food
api_instance.add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------ | ---------- |
| **name** | **str** | The food name. |
| **default_food_measurement_unit_id** | **str** | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint. |
| **default_serving_size** | **str** | The size of the default serving. Nutrition values should be provided for this serving size. |
| **calories** | **str** | The calories in the default serving size. |
| **form_type** | **str** | Form type; LIQUID or DRY. | [optional] |
| **description** | **str** | The description of the food. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods_log**
> add_foods_log(food_id, meal_type_id, unit_id, amount, \_date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
Log Food
Creates food log entries for users with or without foodId value.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be logged. Either foodId or foodName must be provided.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
food_name = 'food_name_example' str | Food entry name. Either foodId or foodName must be provided. (optional)
favorite = true bool | The `true` value will add the food to the user's favorites after creating the log entry; while the `false` value will not. Valid only with foodId value. (optional)
brand_name = 'brand_name_example' str | Brand name of food. Valid only with foodName parameters. (optional)
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Log Food
api_instance.add_foods_log(food_id, meal_type_id, unit_id, amount, _date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **food_id** | **str** | The ID of the food to be logged. Either foodId or foodName must be provided. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **food_name** | **str** | Food entry name. Either foodId or foodName must be provided. | [optional] |
| **favorite** | **bool** | The &x60;true&x60; value will add the food to the user&x27;s favorites after creating the log entry; while the &x60;false&x60; value will not. Valid only with foodId value. | [optional] |
| **brand_name** | **str** | Brand name of food. Valid only with foodName parameters. | [optional] |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_meal**
> add_meal(body)
Create Meal
Creates a meal with the given food contained in the post body.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Create Meal
api_instance.add_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->add_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_foods_goal**
> add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
Update Food Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
calories = 56 int | Manual calorie consumption goal in either calories or intensity must be provided.
intensity = 'intensity_example' str | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. (optional)
personalized = 'personalized_example' str | Food plan type; true or false. (optional)
try:
Update Food Goal
api_instance.add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_foods_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- | ---------- |
| **calories** | **int** | Manual calorie consumption goal in either calories or intensity must be provided. |
| **intensity** | **str** | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. | [optional] |
| **personalized** | **str** | Food plan type; true or false. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_water_goal**
> add_update_water_goal(target)
Update Water Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
target = 56 int | The target water goal in the format X.X is set in unit based on locale.
try:
Update Water Goal
api_instance.add_update_water_goal(target)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_water_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | ------- | ----------------------------------------------------------------------- | ----- |
| **target** | **int** | The target water goal in the format X.X is set in unit based on locale. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_water_log**
> add_water_log(\_date, amount, unit=unit)
Log Water
Creates a log entry for water using units in the unit systems that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned in the format yyyy-MM-dd.
amount = 56 int | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit; `ml`, `fl oz`, or `cup`. (optional)
try:
Log Water
api_instance.add_water_log(_date, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->add_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **\_date** | **date** | The date of records to be returned in the format yyyy-MM-dd. |
| **amount** | **int** | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit; &x60;ml&x60;, &x60;fl oz&x60;, or &x60;cup&x60;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_favorite_food**
> delete_favorite_food(food_id)
Delete Favorite Food
Deletes a food with the given ID to the user's list of favorite foods.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted from user's favorites.
try:
Delete Favorite Food
api_instance.delete_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------------------------------------------ | ----- |
| **food_id** | **str** | The ID of the food to be deleted from user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods**
> delete_foods(food_id)
Delete Custom Food
Deletes custom food for a user and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted.
try:
Delete Custom Food
api_instance.delete_foods(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | --------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods_log**
> delete_foods_log(food_log_id)
Delete Food Log
Deletes a user's food log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be deleted.
try:
Delete Food Log
api_instance.delete_foods_log(food_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ------------------------------------------- | ----- |
| **food_log_id** | **str** | The ID of the food log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_meal**
> delete_meal(meal_id)
Delete Meal
Deletes a user's meal with the given meal id.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
meal_id = 'meal_id_example' str | Id of the meal to delete.
try:
Delete Meal
api_instance.delete_meal(meal_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------- | ----- |
| **meal_id** | **str** | Id of the meal to delete. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_water_log**
> delete_water_log(water_log_id)
Delete Water Log
Deletes a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
try:
Delete Water Log
api_instance.delete_water_log(water_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------ | ----- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**edit_foods_log**
> edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
Edit Food Log
The Edit Food Log endpoint changes the quantity or calories consumed for a user's food log entry with the given Food Log ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be edited.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Edit Food Log
api_instance.edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->edit_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **food_log_id** | **str** | The ID of the food log entry to be edited. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_favorite_foods**
> get_favorite_foods()
Get Favorite Foods
Returns a list of a user's favorite foods in the format requested. A favorite food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Favorite Foods
api_instance.get_favorite_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_favorite_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_by_date**
> get_foods_by_date(\_date)
Get Food Logs
Retreives a summary and list of a user's food log entries for a given day in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Food Logs
api_instance.get_foods_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_goal**
> get_foods_goal()
Get Food Goals
Returns a user's current daily calorie consumption goal and/or foodPlan value in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Goals
api_instance.get_foods_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_info**
> get_foods_info(food_id)
Get Food
Returns the details of a specific food in the Fitbit food databases or a private food that an authorized user has entered in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food.
try:
Get Food
api_instance.get_foods_info(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_info: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------- | ----- |
| **food_id** | **str** | The ID of the food. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_list**
> get_foods_list(query)
Search Foods
Returns a list of public foods from the Fitbit food database and private food the user created in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
query = 'query_example' str | The URL-encoded search query.
try:
Search Foods
api_instance.get_foods_list(query)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_list: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------------------------- | ----- |
| **query** | **str** | The URL-encoded search query. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_locales**
> get_foods_locales()
Get Food Locales
Returns the food locales that the user may choose to search, log, and create food in.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Locales
api_instance.get_foods_locales()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_locales: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_units**
> get_foods_units()
Get Food Units
Returns a list of all valid Fitbit food units in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Units
api_instance.get_foods_units()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_units: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_frequent_foods**
> get_frequent_foods()
Get Frequent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Frequent Foods
api_instance.get_frequent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_frequent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_meals**
> get_meals()
Get Meals
Returns a list of meals created by user in the user's food log in the format requested. User creates and manages meals on the Food Log tab on the website.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Meals
api_instance.get_meals()
except ApiException as e:
print("Exception when calling NutritionApi->get_meals: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_recent_foods**
> get_recent_foods()
Get Recent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Recent Foods
api_instance.get_recent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_recent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_by_date**
> get_water_by_date(\_date)
Get Water Logs
Retreives a summary and list of a user's water log entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Water Logs
api_instance.get_water_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_water_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_goal**
> get_water_goal()
Get Water Goal
Retreives a summary and list of a user's water goal entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Water Goal
api_instance.get_water_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_water_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_meal**
> update_meal(body)
Update Meal
Replaces an existing meal with the contents of the request. The response contains the updated meal.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Update Meal
api_instance.update_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->update_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_water_log**
> update_water_log(water_log_id, amount, unit=unit)
Update Water Log
Updates a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
amount = 'amount_example' str | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit. 'ml', 'fl oz', or 'cup'. (optional)
try:
Update Water Log
api_instance.update_water_log(water_log_id, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->update_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
| **amount** | **str** | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit. &x27;ml&x27;, &x27;fl oz&x27;, or &x27;cup&x27;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
fitbit_web_api.NutritionApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ------------------------------------------------------------------ | -------------------------------------------------------- | -------------------- |
| [**add_favorite_food**](NutritionApi.mdadd_favorite_food) | **POST** /1/user/-/foods/log/favorite/{food-id}.json | Add Favorite Food |
| [**add_foods**](NutritionApi.mdadd_foods) | **POST** /1/user/-/foods.json | Create Food |
| [**add_foods_log**](NutritionApi.mdadd_foods_log) | **POST** /1/user/-/foods/log.json | Log Food |
| [**add_meal**](NutritionApi.mdadd_meal) | **POST** /1/user/-/meals.json | Create Meal |
| [**add_update_foods_goal**](NutritionApi.mdadd_update_foods_goal) | **POST** /1/user/-/foods/log/goal.json | Update Food Goal |
| [**add_update_water_goal**](NutritionApi.mdadd_update_water_goal) | **POST** /1/user/-/foods/log/water/goal.json | Update Water Goal |
| [**add_water_log**](NutritionApi.mdadd_water_log) | **POST** /1/user/-/foods/log/water.json | Log Water |
| [**delete_favorite_food**](NutritionApi.mddelete_favorite_food) | **DELETE** /1/user/-/foods/log/favorite/{food-id}.json | Delete Favorite Food |
| [**delete_foods**](NutritionApi.mddelete_foods) | **DELETE** /1/user/-/foods/{food-id}.json | Delete Custom Food |
| [**delete_foods_log**](NutritionApi.mddelete_foods_log) | **DELETE** /1/user/-/foods/log/{food-log-id}.json | Delete Food Log |
| [**delete_meal**](NutritionApi.mddelete_meal) | **DELETE** /1/user/-/meals/{meal-id}.json | Delete Meal |
| [**delete_water_log**](NutritionApi.mddelete_water_log) | **DELETE** /1/user/-/foods/log/water/{water-log-id}.json | Delete Water Log |
| [**edit_foods_log**](NutritionApi.mdedit_foods_log) | **POST** /1/user/-/foods/log/{food-log-id}.json | Edit Food Log |
| [**get_favorite_foods**](NutritionApi.mdget_favorite_foods) | **GET** /1/user/-/foods/log/favorite.json | Get Favorite Foods |
| [**get_foods_by_date**](NutritionApi.mdget_foods_by_date) | **GET** /1/user/-/foods/log/date/{date}.json | Get Food Logs |
| [**get_foods_goal**](NutritionApi.mdget_foods_goal) | **GET** /1/user/-/foods/log/goal.json | Get Food Goals |
| [**get_foods_info**](NutritionApi.mdget_foods_info) | **GET** /1/foods/{food-id}.json | Get Food |
| [**get_foods_list**](NutritionApi.mdget_foods_list) | **GET** /1/foods/search.json | Search Foods |
| [**get_foods_locales**](NutritionApi.mdget_foods_locales) | **GET** /1/foods/locales.json | Get Food Locales |
| [**get_foods_units**](NutritionApi.mdget_foods_units) | **GET** /1/foods/units.json | Get Food Units |
| [**get_frequent_foods**](NutritionApi.mdget_frequent_foods) | **GET** /1/user/-/foods/log/frequent.json | Get Frequent Foods |
| [**get_meals**](NutritionApi.mdget_meals) | **GET** /1/user/-/meals.json | Get Meals |
| [**get_recent_foods**](NutritionApi.mdget_recent_foods) | **GET** /1/user/-/foods/log/recent.json | Get Recent Foods |
| [**get_water_by_date**](NutritionApi.mdget_water_by_date) | **GET** /1/user/-/foods/log/water/date/{date}.json | Get Water Logs |
| [**get_water_goal**](NutritionApi.mdget_water_goal) | **GET** /1/user/-/foods/log/water/goal.json | Get Water Goal |
| [**update_meal**](NutritionApi.mdupdate_meal) | **POST** /1/user/-/meals/{meal-id}.json | Update Meal |
| [**update_water_log**](NutritionApi.mdupdate_water_log) | **POST** /1/user/-/foods/log/water/{water-log-id}.json | Update Water Log |
**add_favorite_food**
> add_favorite_food(food_id)
Add Favorite Food
Updates a user's daily activity goals and returns a response using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be added to user's favorites.
try:
Add Favorite Food
api_instance.add_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->add_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | -------------------------------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be added to user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods**
> add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
Create Food
Creates a new private food for a user and returns a response in the format requested. The created food is found via the Search Foods call.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
name = 'name_example' str | The food name.
default_food_measurement_unit_id = 'default_food_measurement_unit_id_example' str | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint.
default_serving_size = 'default_serving_size_example' str | The size of the default serving. Nutrition values should be provided for this serving size.
calories = 'calories_example' str | The calories in the default serving size.
form_type = 'form_type_example' str | Form type; LIQUID or DRY. (optional)
description = 'description_example' str | The description of the food. (optional)
try:
Create Food
api_instance.add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------ | ---------- |
| **name** | **str** | The food name. |
| **default_food_measurement_unit_id** | **str** | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint. |
| **default_serving_size** | **str** | The size of the default serving. Nutrition values should be provided for this serving size. |
| **calories** | **str** | The calories in the default serving size. |
| **form_type** | **str** | Form type; LIQUID or DRY. | [optional] |
| **description** | **str** | The description of the food. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods_log**
> add_foods_log(food_id, meal_type_id, unit_id, amount, \_date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
Log Food
Creates food log entries for users with or without foodId value.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be logged. Either foodId or foodName must be provided.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
food_name = 'food_name_example' str | Food entry name. Either foodId or foodName must be provided. (optional)
favorite = true bool | The `true` value will add the food to the user's favorites after creating the log entry; while the `false` value will not. Valid only with foodId value. (optional)
brand_name = 'brand_name_example' str | Brand name of food. Valid only with foodName parameters. (optional)
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Log Food
api_instance.add_foods_log(food_id, meal_type_id, unit_id, amount, _date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **food_id** | **str** | The ID of the food to be logged. Either foodId or foodName must be provided. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **food_name** | **str** | Food entry name. Either foodId or foodName must be provided. | [optional] |
| **favorite** | **bool** | The &x60;true&x60; value will add the food to the user&x27;s favorites after creating the log entry; while the &x60;false&x60; value will not. Valid only with foodId value. | [optional] |
| **brand_name** | **str** | Brand name of food. Valid only with foodName parameters. | [optional] |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_meal**
> add_meal(body)
Create Meal
Creates a meal with the given food contained in the post body.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Create Meal
api_instance.add_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->add_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_foods_goal**
> add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
Update Food Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
calories = 56 int | Manual calorie consumption goal in either calories or intensity must be provided.
intensity = 'intensity_example' str | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. (optional)
personalized = 'personalized_example' str | Food plan type; true or false. (optional)
try:
Update Food Goal
api_instance.add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_foods_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- | ---------- |
| **calories** | **int** | Manual calorie consumption goal in either calories or intensity must be provided. |
| **intensity** | **str** | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. | [optional] |
| **personalized** | **str** | Food plan type; true or false. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_water_goal**
> add_update_water_goal(target)
Update Water Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
target = 56 int | The target water goal in the format X.X is set in unit based on locale.
try:
Update Water Goal
api_instance.add_update_water_goal(target)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_water_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | ------- | ----------------------------------------------------------------------- | ----- |
| **target** | **int** | The target water goal in the format X.X is set in unit based on locale. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_water_log**
> add_water_log(\_date, amount, unit=unit)
Log Water
Creates a log entry for water using units in the unit systems that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned in the format yyyy-MM-dd.
amount = 56 int | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit; `ml`, `fl oz`, or `cup`. (optional)
try:
Log Water
api_instance.add_water_log(_date, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->add_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **\_date** | **date** | The date of records to be returned in the format yyyy-MM-dd. |
| **amount** | **int** | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit; &x60;ml&x60;, &x60;fl oz&x60;, or &x60;cup&x60;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_favorite_food**
> delete_favorite_food(food_id)
Delete Favorite Food
Deletes a food with the given ID to the user's list of favorite foods.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted from user's favorites.
try:
Delete Favorite Food
api_instance.delete_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------------------------------------------ | ----- |
| **food_id** | **str** | The ID of the food to be deleted from user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods**
> delete_foods(food_id)
Delete Custom Food
Deletes custom food for a user and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted.
try:
Delete Custom Food
api_instance.delete_foods(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | --------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods_log**
> delete_foods_log(food_log_id)
Delete Food Log
Deletes a user's food log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be deleted.
try:
Delete Food Log
api_instance.delete_foods_log(food_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ------------------------------------------- | ----- |
| **food_log_id** | **str** | The ID of the food log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_meal**
> delete_meal(meal_id)
Delete Meal
Deletes a user's meal with the given meal id.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
meal_id = 'meal_id_example' str | Id of the meal to delete.
try:
Delete Meal
api_instance.delete_meal(meal_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------- | ----- |
| **meal_id** | **str** | Id of the meal to delete. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_water_log**
> delete_water_log(water_log_id)
Delete Water Log
Deletes a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
try:
Delete Water Log
api_instance.delete_water_log(water_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------ | ----- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**edit_foods_log**
> edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
Edit Food Log
The Edit Food Log endpoint changes the quantity or calories consumed for a user's food log entry with the given Food Log ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be edited.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Edit Food Log
api_instance.edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->edit_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **food_log_id** | **str** | The ID of the food log entry to be edited. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_favorite_foods**
> get_favorite_foods()
Get Favorite Foods
Returns a list of a user's favorite foods in the format requested. A favorite food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Favorite Foods
api_instance.get_favorite_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_favorite_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_by_date**
> get_foods_by_date(\_date)
Get Food Logs
Retreives a summary and list of a user's food log entries for a given day in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Food Logs
api_instance.get_foods_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_goal**
> get_foods_goal()
Get Food Goals
Returns a user's current daily calorie consumption goal and/or foodPlan value in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Goals
api_instance.get_foods_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_info**
> get_foods_info(food_id)
Get Food
Returns the details of a specific food in the Fitbit food databases or a private food that an authorized user has entered in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food.
try:
Get Food
api_instance.get_foods_info(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_info: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------- | ----- |
| **food_id** | **str** | The ID of the food. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_list**
> get_foods_list(query)
Search Foods
Returns a list of public foods from the Fitbit food database and private food the user created in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
query = 'query_example' str | The URL-encoded search query.
try:
Search Foods
api_instance.get_foods_list(query)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_list: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------------------------- | ----- |
| **query** | **str** | The URL-encoded search query. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_locales**
> get_foods_locales()
Get Food Locales
Returns the food locales that the user may choose to search, log, and create food in.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Locales
api_instance.get_foods_locales()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_locales: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_units**
> get_foods_units()
Get Food Units
Returns a list of all valid Fitbit food units in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Units
api_instance.get_foods_units()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_units: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_frequent_foods**
> get_frequent_foods()
Get Frequent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Frequent Foods
api_instance.get_frequent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_frequent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_meals**
> get_meals()
Get Meals
Returns a list of meals created by user in the user's food log in the format requested. User creates and manages meals on the Food Log tab on the website.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Meals
api_instance.get_meals()
except ApiException as e:
print("Exception when calling NutritionApi->get_meals: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_recent_foods**
> get_recent_foods()
Get Recent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Recent Foods
api_instance.get_recent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_recent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_by_date**
> get_water_by_date(\_date)
Get Water Logs
Retreives a summary and list of a user's water log entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Water Logs
api_instance.get_water_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_water_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_goal**
> get_water_goal()
Get Water Goal
Retreives a summary and list of a user's water goal entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Water Goal
api_instance.get_water_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_water_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_meal**
> update_meal(body)
Update Meal
Replaces an existing meal with the contents of the request. The response contains the updated meal.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Update Meal
api_instance.update_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->update_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_water_log**
> update_water_log(water_log_id, amount, unit=unit)
Update Water Log
Updates a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
amount = 'amount_example' str | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit. 'ml', 'fl oz', or 'cup'. (optional)
try:
Update Water Log
api_instance.update_water_log(water_log_id, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->update_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
| **amount** | **str** | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit. &x27;ml&x27;, &x27;fl oz&x27;, or &x27;cup&x27;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
fitbit_web_api.BodyApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------ | -------------------- |
| [**add_body_fat_log**](BodyApi.mdadd_body_fat_log) | **POST** /1/user/-/body/log/fat.json | Log Body Fat |
| [**add_weight_log**](BodyApi.mdadd_weight_log) | **POST** /1/user/-/body/log/weight.json | Log Weight |
| [**delete_body_fat_log**](BodyApi.mddelete_body_fat_log) | **DELETE** /1/user/-/body/log/fat/{body-fat-log-id}.json | Delete Body Fat Log |
| [**delete_weight_log**](BodyApi.mddelete_weight_log) | **DELETE** /1/user/-/body/log/weight/{body-weight-log-id}.json | Delete Weight Log |
| [**get_body_fat_by_date**](BodyApi.mdget_body_fat_by_date) | **GET** /1/user/-/body/log/fat/date/{date}.json | Get Body Fat Logs |
| [**get_body_fat_by_date_period**](BodyApi.mdget_body_fat_by_date_period) | **GET** /1/user/-/body/log/fat/date/{date}/{period}.json | Get Body Fat Logs |
| [**get_body_fat_by_date_range**](BodyApi.mdget_body_fat_by_date_range) | **GET** /1/user/-/body/log/fat/date/{base-date}/{end-date}.json | Get Body Fat Logs |
| [**get_body_goals**](BodyApi.mdget_body_goals) | **GET** /1/user/-/body/log/{goal-type}/goal.json | Get Body Goals |
| [**get_weight_by_date**](BodyApi.mdget_weight_by_date) | **GET** /1/user/-/body/log/weight/date/{date}.json | Get Weight Logs |
| [**get_weight_by_date_period**](BodyApi.mdget_weight_by_date_period) | **GET** /1/user/-/body/log/weight/date/{date}/{period}.json | Get Body Fat Logs |
| [**get_weight_by_date_range**](BodyApi.mdget_weight_by_date_range) | **GET** /1/user/-/body/log/weight/date/{base-date}/{end-date}.json | Get Body Fat Logs |
| [**update_body_fat_goal**](BodyApi.mdupdate_body_fat_goal) | **POST** /1/user/-/body/log/fat/goal.json | Update Body Fat Goal |
| [**update_weight_goal**](BodyApi.mdupdate_weight_goal) | **POST** /1/user/-/body/log/weight/goal.json | Update Weight Goal |
**add_body_fat_log**
> add_body_fat_log(fat, \_date, time)
Log Body Fat
Creates a log entry for body fat and returns a response in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
fat = 56 int | Body fat in the format of X.XX in the unit system that corresponds to the Accept-Language header provided.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
time = 'time_example' str | Time of the measurement in hours and minutes in the format HH:mm:ss that is set to the last second of the day if not provided.
try:
Log Body Fat
api_instance.add_body_fat_log(fat, _date, time)
except ApiException as e:
print("Exception when calling BodyApi->add_body_fat_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ | ----- |
| **fat** | **int** | Body fat in the format of X.XX in the unit system that corresponds to the Accept-Language header provided. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **time** | **str** | Time of the measurement in hours and minutes in the format HH:mm:ss that is set to the last second of the day if not provided. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_weight_log**
> add_weight_log(weight, \_date, time=time)
Log Weight
Creates log entry for a body weight using units in the unit systems that corresponds to the Accept-Language header provided and gets a response in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
weight = 56 int | Weight in the format of X.XX.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
time = 'time_example' str | Time of the measurement; hours and minutes in the format of HH:mm:ss, which is set to the last second of the day if not provided. (optional)
try:
Log Weight
api_instance.add_weight_log(weight, _date, time=time)
except ApiException as e:
print("Exception when calling BodyApi->add_weight_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **weight** | **int** | Weight in the format of X.XX. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **time** | **str** | Time of the measurement; hours and minutes in the format of HH:mm:ss, which is set to the last second of the day if not provided. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_body_fat_log**
> delete_body_fat_log(body_fat_log_id)
Delete Body Fat Log
Deletes a user's body fat log entry with the given ID.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
body_fat_log_id = 56 int | The ID of the body fat log entry.
try:
Delete Body Fat Log
api_instance.delete_body_fat_log(body_fat_log_id)
except ApiException as e:
print("Exception when calling BodyApi->delete_body_fat_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------- | ------- | --------------------------------- | ----- |
| **body_fat_log_id** | **int** | The ID of the body fat log entry. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_weight_log**
> delete_weight_log(body_weight_log_id)
Delete Weight Log
Deletes a user's body weight log entrywith the given ID.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
body_weight_log_id = 56 int | The ID of the body weight log entry.
try:
Delete Weight Log
api_instance.delete_weight_log(body_weight_log_id)
except ApiException as e:
print("Exception when calling BodyApi->delete_weight_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------------- | ------- | ------------------------------------ | ----- |
| **body_weight_log_id** | **int** | The ID of the body weight log entry. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_fat_by_date**
> get_body_fat_by_date(\_date)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
try:
Get Body Fat Logs
api_instance.get_body_fat_by_date(_date)
except ApiException as e:
print("Exception when calling BodyApi->get_body_fat_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ---------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_fat_by_date_period**
> get_body_fat_by_date_period(\_date, period)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
period = 'period_example' str | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max.
try:
Get Body Fat Logs
api_instance.get_body_fat_by_date_period(_date, period)
except ApiException as e:
print("Exception when calling BodyApi->get_body_fat_by_date_period: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ----------------------------------------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
| **period** | **str** | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_fat_by_date_range**
> get_body_fat_by_date_range(base_date, end_date)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
base_date = '2013-10-20' date | The range start date in the format yyyy-MM-dd or today.
end_date = '2013-10-20' date | The end date of the range.
try:
Get Body Fat Logs
api_instance.get_body_fat_by_date_range(base_date, end_date)
except ApiException as e:
print("Exception when calling BodyApi->get_body_fat_by_date_range: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------- | -------- | ------------------------------------------------------- | ----- |
| **base_date** | **date** | The range start date in the format yyyy-MM-dd or today. |
| **end_date** | **date** | The end date of the range. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_goals**
> get_body_goals(goal_type)
Get Body Goals
Retreives a user's current body fat percentage or weight goal using units in the unit systems that corresponds to the Accept-Language header providedin the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
goal_type = 'goal_type_example' str | weight or fat.
try:
Get Body Goals
api_instance.get_body_goals(goal_type)
except ApiException as e:
print("Exception when calling BodyApi->get_body_goals: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------- | ------- | -------------- | ----- |
| **goal_type** | **str** | weight or fat. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_weight_by_date**
> get_weight_by_date(\_date)
Get Weight Logs
Retreives a list of all user's body weight log entries for a given day using units in the unit systems which corresponds to the Accept-Language header provided.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
try:
Get Weight Logs
api_instance.get_weight_by_date(_date)
except ApiException as e:
print("Exception when calling BodyApi->get_weight_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ---------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_weight_by_date_period**
> get_weight_by_date_period(\_date, period)
Get Body Fat Logs
Retreives a list of all user's body weight log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
period = 'period_example' str | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max.
try:
Get Body Fat Logs
api_instance.get_weight_by_date_period(_date, period)
except ApiException as e:
print("Exception when calling BodyApi->get_weight_by_date_period: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ----------------------------------------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
| **period** | **str** | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_weight_by_date_range**
> get_weight_by_date_range(base_date, end_date)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
base_date = '2013-10-20' date | The range start date in the format yyyy-MM-dd or today.
end_date = '2013-10-20' date | The end date of the range.
try:
Get Body Fat Logs
api_instance.get_weight_by_date_range(base_date, end_date)
except ApiException as e:
print("Exception when calling BodyApi->get_weight_by_date_range: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------- | -------- | ------------------------------------------------------- | ----- |
| **base_date** | **date** | The range start date in the format yyyy-MM-dd or today. |
| **end_date** | **date** | The end date of the range. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_body_fat_goal**
> update_body_fat_goal(fat)
Update Body Fat Goal
Updates user's fat percentage goal.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
fat = 'fat_example' str | Target body fat percentage; in the format X.XX.
try:
Update Body Fat Goal
api_instance.update_body_fat_goal(fat)
except ApiException as e:
print("Exception when calling BodyApi->update_body_fat_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------- | ------- | ----------------------------------------------- | ----- |
| **fat** | **str** | Target body fat percentage; in the format X.XX. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_weight_goal**
> update_weight_goal(start_date, start_weight, weight=weight)
Update Weight Goal
Updates user's fat percentage goal.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
start_date = 'start_date_example' str | Weight goal start date; in the format yyyy-MM-dd.
start_weight = 'start_weight_example' str | Weight goal start weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided.
weight = 'weight_example' str | Weight goal target weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided; required if user doesn't have an existing weight goal. (optional)
try:
Update Weight Goal
api_instance.update_weight_goal(start_date, start_weight, weight=weight)
except ApiException as e:
print("Exception when calling BodyApi->update_weight_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **start_date** | **str** | Weight goal start date; in the format yyyy-MM-dd. |
| **start_weight** | **str** | Weight goal start weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided. |
| **weight** | **str** | Weight goal target weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided; required if user doesn&x27;t have an existing weight goal. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
fitbit_web_api.NutritionApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ------------------------------------------------------------------ | -------------------------------------------------------- | -------------------- |
| [**add_favorite_food**](NutritionApi.mdadd_favorite_food) | **POST** /1/user/-/foods/log/favorite/{food-id}.json | Add Favorite Food |
| [**add_foods**](NutritionApi.mdadd_foods) | **POST** /1/user/-/foods.json | Create Food |
| [**add_foods_log**](NutritionApi.mdadd_foods_log) | **POST** /1/user/-/foods/log.json | Log Food |
| [**add_meal**](NutritionApi.mdadd_meal) | **POST** /1/user/-/meals.json | Create Meal |
| [**add_update_foods_goal**](NutritionApi.mdadd_update_foods_goal) | **POST** /1/user/-/foods/log/goal.json | Update Food Goal |
| [**add_update_water_goal**](NutritionApi.mdadd_update_water_goal) | **POST** /1/user/-/foods/log/water/goal.json | Update Water Goal |
| [**add_water_log**](NutritionApi.mdadd_water_log) | **POST** /1/user/-/foods/log/water.json | Log Water |
| [**delete_favorite_food**](NutritionApi.mddelete_favorite_food) | **DELETE** /1/user/-/foods/log/favorite/{food-id}.json | Delete Favorite Food |
| [**delete_foods**](NutritionApi.mddelete_foods) | **DELETE** /1/user/-/foods/{food-id}.json | Delete Custom Food |
| [**delete_foods_log**](NutritionApi.mddelete_foods_log) | **DELETE** /1/user/-/foods/log/{food-log-id}.json | Delete Food Log |
| [**delete_meal**](NutritionApi.mddelete_meal) | **DELETE** /1/user/-/meals/{meal-id}.json | Delete Meal |
| [**delete_water_log**](NutritionApi.mddelete_water_log) | **DELETE** /1/user/-/foods/log/water/{water-log-id}.json | Delete Water Log |
| [**edit_foods_log**](NutritionApi.mdedit_foods_log) | **POST** /1/user/-/foods/log/{food-log-id}.json | Edit Food Log |
| [**get_favorite_foods**](NutritionApi.mdget_favorite_foods) | **GET** /1/user/-/foods/log/favorite.json | Get Favorite Foods |
| [**get_foods_by_date**](NutritionApi.mdget_foods_by_date) | **GET** /1/user/-/foods/log/date/{date}.json | Get Food Logs |
| [**get_foods_goal**](NutritionApi.mdget_foods_goal) | **GET** /1/user/-/foods/log/goal.json | Get Food Goals |
| [**get_foods_info**](NutritionApi.mdget_foods_info) | **GET** /1/foods/{food-id}.json | Get Food |
| [**get_foods_list**](NutritionApi.mdget_foods_list) | **GET** /1/foods/search.json | Search Foods |
| [**get_foods_locales**](NutritionApi.mdget_foods_locales) | **GET** /1/foods/locales.json | Get Food Locales |
| [**get_foods_units**](NutritionApi.mdget_foods_units) | **GET** /1/foods/units.json | Get Food Units |
| [**get_frequent_foods**](NutritionApi.mdget_frequent_foods) | **GET** /1/user/-/foods/log/frequent.json | Get Frequent Foods |
| [**get_meals**](NutritionApi.mdget_meals) | **GET** /1/user/-/meals.json | Get Meals |
| [**get_recent_foods**](NutritionApi.mdget_recent_foods) | **GET** /1/user/-/foods/log/recent.json | Get Recent Foods |
| [**get_water_by_date**](NutritionApi.mdget_water_by_date) | **GET** /1/user/-/foods/log/water/date/{date}.json | Get Water Logs |
| [**get_water_goal**](NutritionApi.mdget_water_goal) | **GET** /1/user/-/foods/log/water/goal.json | Get Water Goal |
| [**update_meal**](NutritionApi.mdupdate_meal) | **POST** /1/user/-/meals/{meal-id}.json | Update Meal |
| [**update_water_log**](NutritionApi.mdupdate_water_log) | **POST** /1/user/-/foods/log/water/{water-log-id}.json | Update Water Log |
**add_favorite_food**
> add_favorite_food(food_id)
Add Favorite Food
Updates a user's daily activity goals and returns a response using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be added to user's favorites.
try:
Add Favorite Food
api_instance.add_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->add_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | -------------------------------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be added to user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods**
> add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
Create Food
Creates a new private food for a user and returns a response in the format requested. The created food is found via the Search Foods call.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
name = 'name_example' str | The food name.
default_food_measurement_unit_id = 'default_food_measurement_unit_id_example' str | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint.
default_serving_size = 'default_serving_size_example' str | The size of the default serving. Nutrition values should be provided for this serving size.
calories = 'calories_example' str | The calories in the default serving size.
form_type = 'form_type_example' str | Form type; LIQUID or DRY. (optional)
description = 'description_example' str | The description of the food. (optional)
try:
Create Food
api_instance.add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------ | ---------- |
| **name** | **str** | The food name. |
| **default_food_measurement_unit_id** | **str** | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint. |
| **default_serving_size** | **str** | The size of the default serving. Nutrition values should be provided for this serving size. |
| **calories** | **str** | The calories in the default serving size. |
| **form_type** | **str** | Form type; LIQUID or DRY. | [optional] |
| **description** | **str** | The description of the food. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods_log**
> add_foods_log(food_id, meal_type_id, unit_id, amount, \_date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
Log Food
Creates food log entries for users with or without foodId value.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be logged. Either foodId or foodName must be provided.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
food_name = 'food_name_example' str | Food entry name. Either foodId or foodName must be provided. (optional)
favorite = true bool | The `true` value will add the food to the user's favorites after creating the log entry; while the `false` value will not. Valid only with foodId value. (optional)
brand_name = 'brand_name_example' str | Brand name of food. Valid only with foodName parameters. (optional)
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Log Food
api_instance.add_foods_log(food_id, meal_type_id, unit_id, amount, _date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **food_id** | **str** | The ID of the food to be logged. Either foodId or foodName must be provided. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **food_name** | **str** | Food entry name. Either foodId or foodName must be provided. | [optional] |
| **favorite** | **bool** | The &x60;true&x60; value will add the food to the user&x27;s favorites after creating the log entry; while the &x60;false&x60; value will not. Valid only with foodId value. | [optional] |
| **brand_name** | **str** | Brand name of food. Valid only with foodName parameters. | [optional] |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_meal**
> add_meal(body)
Create Meal
Creates a meal with the given food contained in the post body.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Create Meal
api_instance.add_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->add_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_foods_goal**
> add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
Update Food Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
calories = 56 int | Manual calorie consumption goal in either calories or intensity must be provided.
intensity = 'intensity_example' str | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. (optional)
personalized = 'personalized_example' str | Food plan type; true or false. (optional)
try:
Update Food Goal
api_instance.add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_foods_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- | ---------- |
| **calories** | **int** | Manual calorie consumption goal in either calories or intensity must be provided. |
| **intensity** | **str** | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. | [optional] |
| **personalized** | **str** | Food plan type; true or false. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_water_goal**
> add_update_water_goal(target)
Update Water Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
target = 56 int | The target water goal in the format X.X is set in unit based on locale.
try:
Update Water Goal
api_instance.add_update_water_goal(target)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_water_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | ------- | ----------------------------------------------------------------------- | ----- |
| **target** | **int** | The target water goal in the format X.X is set in unit based on locale. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_water_log**
> add_water_log(\_date, amount, unit=unit)
Log Water
Creates a log entry for water using units in the unit systems that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned in the format yyyy-MM-dd.
amount = 56 int | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit; `ml`, `fl oz`, or `cup`. (optional)
try:
Log Water
api_instance.add_water_log(_date, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->add_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **\_date** | **date** | The date of records to be returned in the format yyyy-MM-dd. |
| **amount** | **int** | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit; &x60;ml&x60;, &x60;fl oz&x60;, or &x60;cup&x60;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_favorite_food**
> delete_favorite_food(food_id)
Delete Favorite Food
Deletes a food with the given ID to the user's list of favorite foods.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted from user's favorites.
try:
Delete Favorite Food
api_instance.delete_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------------------------------------------ | ----- |
| **food_id** | **str** | The ID of the food to be deleted from user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods**
> delete_foods(food_id)
Delete Custom Food
Deletes custom food for a user and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted.
try:
Delete Custom Food
api_instance.delete_foods(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | --------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods_log**
> delete_foods_log(food_log_id)
Delete Food Log
Deletes a user's food log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be deleted.
try:
Delete Food Log
api_instance.delete_foods_log(food_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ------------------------------------------- | ----- |
| **food_log_id** | **str** | The ID of the food log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_meal**
> delete_meal(meal_id)
Delete Meal
Deletes a user's meal with the given meal id.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
meal_id = 'meal_id_example' str | Id of the meal to delete.
try:
Delete Meal
api_instance.delete_meal(meal_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------- | ----- |
| **meal_id** | **str** | Id of the meal to delete. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_water_log**
> delete_water_log(water_log_id)
Delete Water Log
Deletes a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
try:
Delete Water Log
api_instance.delete_water_log(water_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------ | ----- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**edit_foods_log**
> edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
Edit Food Log
The Edit Food Log endpoint changes the quantity or calories consumed for a user's food log entry with the given Food Log ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be edited.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Edit Food Log
api_instance.edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->edit_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **food_log_id** | **str** | The ID of the food log entry to be edited. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_favorite_foods**
> get_favorite_foods()
Get Favorite Foods
Returns a list of a user's favorite foods in the format requested. A favorite food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Favorite Foods
api_instance.get_favorite_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_favorite_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_by_date**
> get_foods_by_date(\_date)
Get Food Logs
Retreives a summary and list of a user's food log entries for a given day in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Food Logs
api_instance.get_foods_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_goal**
> get_foods_goal()
Get Food Goals
Returns a user's current daily calorie consumption goal and/or foodPlan value in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Goals
api_instance.get_foods_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_info**
> get_foods_info(food_id)
Get Food
Returns the details of a specific food in the Fitbit food databases or a private food that an authorized user has entered in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food.
try:
Get Food
api_instance.get_foods_info(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_info: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------- | ----- |
| **food_id** | **str** | The ID of the food. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_list**
> get_foods_list(query)
Search Foods
Returns a list of public foods from the Fitbit food database and private food the user created in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
query = 'query_example' str | The URL-encoded search query.
try:
Search Foods
api_instance.get_foods_list(query)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_list: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------------------------- | ----- |
| **query** | **str** | The URL-encoded search query. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_locales**
> get_foods_locales()
Get Food Locales
Returns the food locales that the user may choose to search, log, and create food in.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Locales
api_instance.get_foods_locales()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_locales: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_units**
> get_foods_units()
Get Food Units
Returns a list of all valid Fitbit food units in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Units
api_instance.get_foods_units()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_units: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_frequent_foods**
> get_frequent_foods()
Get Frequent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Frequent Foods
api_instance.get_frequent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_frequent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_meals**
> get_meals()
Get Meals
Returns a list of meals created by user in the user's food log in the format requested. User creates and manages meals on the Food Log tab on the website.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Meals
api_instance.get_meals()
except ApiException as e:
print("Exception when calling NutritionApi->get_meals: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_recent_foods**
> get_recent_foods()
Get Recent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Recent Foods
api_instance.get_recent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_recent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_by_date**
> get_water_by_date(\_date)
Get Water Logs
Retreives a summary and list of a user's water log entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Water Logs
api_instance.get_water_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_water_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_goal**
> get_water_goal()
Get Water Goal
Retreives a summary and list of a user's water goal entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Water Goal
api_instance.get_water_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_water_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_meal**
> update_meal(body)
Update Meal
Replaces an existing meal with the contents of the request. The response contains the updated meal.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Update Meal
api_instance.update_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->update_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_water_log**
> update_water_log(water_log_id, amount, unit=unit)
Update Water Log
Updates a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
amount = 'amount_example' str | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit. 'ml', 'fl oz', or 'cup'. (optional)
try:
Update Water Log
api_instance.update_water_log(water_log_id, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->update_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
| **amount** | **str** | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit. &x27;ml&x27;, &x27;fl oz&x27;, or &x27;cup&x27;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
fitbit_web_api.NutritionApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ------------------------------------------------------------------ | -------------------------------------------------------- | -------------------- |
| [**add_favorite_food**](NutritionApi.mdadd_favorite_food) | **POST** /1/user/-/foods/log/favorite/{food-id}.json | Add Favorite Food |
| [**add_foods**](NutritionApi.mdadd_foods) | **POST** /1/user/-/foods.json | Create Food |
| [**add_foods_log**](NutritionApi.mdadd_foods_log) | **POST** /1/user/-/foods/log.json | Log Food |
| [**add_meal**](NutritionApi.mdadd_meal) | **POST** /1/user/-/meals.json | Create Meal |
| [**add_update_foods_goal**](NutritionApi.mdadd_update_foods_goal) | **POST** /1/user/-/foods/log/goal.json | Update Food Goal |
| [**add_update_water_goal**](NutritionApi.mdadd_update_water_goal) | **POST** /1/user/-/foods/log/water/goal.json | Update Water Goal |
| [**add_water_log**](NutritionApi.mdadd_water_log) | **POST** /1/user/-/foods/log/water.json | Log Water |
| [**delete_favorite_food**](NutritionApi.mddelete_favorite_food) | **DELETE** /1/user/-/foods/log/favorite/{food-id}.json | Delete Favorite Food |
| [**delete_foods**](NutritionApi.mddelete_foods) | **DELETE** /1/user/-/foods/{food-id}.json | Delete Custom Food |
| [**delete_foods_log**](NutritionApi.mddelete_foods_log) | **DELETE** /1/user/-/foods/log/{food-log-id}.json | Delete Food Log |
| [**delete_meal**](NutritionApi.mddelete_meal) | **DELETE** /1/user/-/meals/{meal-id}.json | Delete Meal |
| [**delete_water_log**](NutritionApi.mddelete_water_log) | **DELETE** /1/user/-/foods/log/water/{water-log-id}.json | Delete Water Log |
| [**edit_foods_log**](NutritionApi.mdedit_foods_log) | **POST** /1/user/-/foods/log/{food-log-id}.json | Edit Food Log |
| [**get_favorite_foods**](NutritionApi.mdget_favorite_foods) | **GET** /1/user/-/foods/log/favorite.json | Get Favorite Foods |
| [**get_foods_by_date**](NutritionApi.mdget_foods_by_date) | **GET** /1/user/-/foods/log/date/{date}.json | Get Food Logs |
| [**get_foods_goal**](NutritionApi.mdget_foods_goal) | **GET** /1/user/-/foods/log/goal.json | Get Food Goals |
| [**get_foods_info**](NutritionApi.mdget_foods_info) | **GET** /1/foods/{food-id}.json | Get Food |
| [**get_foods_list**](NutritionApi.mdget_foods_list) | **GET** /1/foods/search.json | Search Foods |
| [**get_foods_locales**](NutritionApi.mdget_foods_locales) | **GET** /1/foods/locales.json | Get Food Locales |
| [**get_foods_units**](NutritionApi.mdget_foods_units) | **GET** /1/foods/units.json | Get Food Units |
| [**get_frequent_foods**](NutritionApi.mdget_frequent_foods) | **GET** /1/user/-/foods/log/frequent.json | Get Frequent Foods |
| [**get_meals**](NutritionApi.mdget_meals) | **GET** /1/user/-/meals.json | Get Meals |
| [**get_recent_foods**](NutritionApi.mdget_recent_foods) | **GET** /1/user/-/foods/log/recent.json | Get Recent Foods |
| [**get_water_by_date**](NutritionApi.mdget_water_by_date) | **GET** /1/user/-/foods/log/water/date/{date}.json | Get Water Logs |
| [**get_water_goal**](NutritionApi.mdget_water_goal) | **GET** /1/user/-/foods/log/water/goal.json | Get Water Goal |
| [**update_meal**](NutritionApi.mdupdate_meal) | **POST** /1/user/-/meals/{meal-id}.json | Update Meal |
| [**update_water_log**](NutritionApi.mdupdate_water_log) | **POST** /1/user/-/foods/log/water/{water-log-id}.json | Update Water Log |
**add_favorite_food**
> add_favorite_food(food_id)
Add Favorite Food
Updates a user's daily activity goals and returns a response using units in the unit system which corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be added to user's favorites.
try:
Add Favorite Food
api_instance.add_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->add_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | -------------------------------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be added to user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods**
> add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
Create Food
Creates a new private food for a user and returns a response in the format requested. The created food is found via the Search Foods call.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
name = 'name_example' str | The food name.
default_food_measurement_unit_id = 'default_food_measurement_unit_id_example' str | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint.
default_serving_size = 'default_serving_size_example' str | The size of the default serving. Nutrition values should be provided for this serving size.
calories = 'calories_example' str | The calories in the default serving size.
form_type = 'form_type_example' str | Form type; LIQUID or DRY. (optional)
description = 'description_example' str | The description of the food. (optional)
try:
Create Food
api_instance.add_foods(name, default_food_measurement_unit_id, default_serving_size, calories, form_type=form_type, description=description)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------ | ---------- |
| **name** | **str** | The food name. |
| **default_food_measurement_unit_id** | **str** | The ID of the default measurement unit. Full list of units can be retrieved via the Get Food Units endpoint. |
| **default_serving_size** | **str** | The size of the default serving. Nutrition values should be provided for this serving size. |
| **calories** | **str** | The calories in the default serving size. |
| **form_type** | **str** | Form type; LIQUID or DRY. | [optional] |
| **description** | **str** | The description of the food. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_foods_log**
> add_foods_log(food_id, meal_type_id, unit_id, amount, \_date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
Log Food
Creates food log entries for users with or without foodId value.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be logged. Either foodId or foodName must be provided.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
food_name = 'food_name_example' str | Food entry name. Either foodId or foodName must be provided. (optional)
favorite = true bool | The `true` value will add the food to the user's favorites after creating the log entry; while the `false` value will not. Valid only with foodId value. (optional)
brand_name = 'brand_name_example' str | Brand name of food. Valid only with foodName parameters. (optional)
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Log Food
api_instance.add_foods_log(food_id, meal_type_id, unit_id, amount, _date, food_name=food_name, favorite=favorite, brand_name=brand_name, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->add_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **food_id** | **str** | The ID of the food to be logged. Either foodId or foodName must be provided. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **food_name** | **str** | Food entry name. Either foodId or foodName must be provided. | [optional] |
| **favorite** | **bool** | The &x60;true&x60; value will add the food to the user&x27;s favorites after creating the log entry; while the &x60;false&x60; value will not. Valid only with foodId value. | [optional] |
| **brand_name** | **str** | Brand name of food. Valid only with foodName parameters. | [optional] |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_meal**
> add_meal(body)
Create Meal
Creates a meal with the given food contained in the post body.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Create Meal
api_instance.add_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->add_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_foods_goal**
> add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
Update Food Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
calories = 56 int | Manual calorie consumption goal in either calories or intensity must be provided.
intensity = 'intensity_example' str | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. (optional)
personalized = 'personalized_example' str | Food plan type; true or false. (optional)
try:
Update Food Goal
api_instance.add_update_foods_goal(calories, intensity=intensity, personalized=personalized)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_foods_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- | ---------- |
| **calories** | **int** | Manual calorie consumption goal in either calories or intensity must be provided. |
| **intensity** | **str** | Food plan intensity (MAINTENANCE, EASIER, MEDIUM, KINDAHARD, or HARDER). Either calories or intensity must be provided. | [optional] |
| **personalized** | **str** | Food plan type; true or false. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_update_water_goal**
> add_update_water_goal(target)
Update Water Goal
Updates a user's daily calories consumption goal or food plan and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
target = 56 int | The target water goal in the format X.X is set in unit based on locale.
try:
Update Water Goal
api_instance.add_update_water_goal(target)
except ApiException as e:
print("Exception when calling NutritionApi->add_update_water_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | ------- | ----------------------------------------------------------------------- | ----- |
| **target** | **int** | The target water goal in the format X.X is set in unit based on locale. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_water_log**
> add_water_log(\_date, amount, unit=unit)
Log Water
Creates a log entry for water using units in the unit systems that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned in the format yyyy-MM-dd.
amount = 56 int | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit; `ml`, `fl oz`, or `cup`. (optional)
try:
Log Water
api_instance.add_water_log(_date, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->add_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **\_date** | **date** | The date of records to be returned in the format yyyy-MM-dd. |
| **amount** | **int** | The amount consumption in the format X.XX and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit; &x60;ml&x60;, &x60;fl oz&x60;, or &x60;cup&x60;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_favorite_food**
> delete_favorite_food(food_id)
Delete Favorite Food
Deletes a food with the given ID to the user's list of favorite foods.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted from user's favorites.
try:
Delete Favorite Food
api_instance.delete_favorite_food(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_favorite_food: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------------------------------------------ | ----- |
| **food_id** | **str** | The ID of the food to be deleted from user&x27;s favorites. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods**
> delete_foods(food_id)
Delete Custom Food
Deletes custom food for a user and returns a response in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food to be deleted.
try:
Delete Custom Food
api_instance.delete_foods(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | --------------------------------- | ----- |
| **food_id** | **str** | The ID of the food to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_foods_log**
> delete_foods_log(food_log_id)
Delete Food Log
Deletes a user's food log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be deleted.
try:
Delete Food Log
api_instance.delete_foods_log(food_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------------- | ------- | ------------------------------------------- | ----- |
| **food_log_id** | **str** | The ID of the food log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_meal**
> delete_meal(meal_id)
Delete Meal
Deletes a user's meal with the given meal id.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
meal_id = 'meal_id_example' str | Id of the meal to delete.
try:
Delete Meal
api_instance.delete_meal(meal_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------------- | ----- |
| **meal_id** | **str** | Id of the meal to delete. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_water_log**
> delete_water_log(water_log_id)
Delete Water Log
Deletes a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
try:
Delete Water Log
api_instance.delete_water_log(water_log_id)
except ApiException as e:
print("Exception when calling NutritionApi->delete_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------ | ----- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**edit_foods_log**
> edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
Edit Food Log
The Edit Food Log endpoint changes the quantity or calories consumed for a user's food log entry with the given Food Log ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_log_id = 'food_log_id_example' str | The ID of the food log entry to be edited.
meal_type_id = 'meal_type_id_example' str | Meal types. 1=Breakfast; 2=Morning Snack; 3=Lunch; 4=Afternoon Snack; 5=Dinner; 7=Anytime.
unit_id = 'unit_id_example' str | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units.
amount = 'amount_example' str | The amount consumed in the format X.XX in the specified unitId.
calories = 56 int | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. (optional)
try:
Edit Food Log
api_instance.edit_foods_log(food_log_id, meal_type_id, unit_id, amount, calories=calories)
except ApiException as e:
print("Exception when calling NutritionApi->edit_foods_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **food_log_id** | **str** | The ID of the food log entry to be edited. |
| **meal_type_id** | **str** | Meal types. 1&x3D;Breakfast; 2&x3D;Morning Snack; 3&x3D;Lunch; 4&x3D;Afternoon Snack; 5&x3D;Dinner; 7&x3D;Anytime. |
| **unit_id** | **str** | The ID of units used. Typically retrieved via a previous call to Get Food Logs, Search Foods, or Get Food Units. |
| **amount** | **str** | The amount consumed in the format X.XX in the specified unitId. |
| **calories** | **int** | Calories for this serving size. This is allowed with foodName parameter (default to zero); otherwise it is ignored. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_favorite_foods**
> get_favorite_foods()
Get Favorite Foods
Returns a list of a user's favorite foods in the format requested. A favorite food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Favorite Foods
api_instance.get_favorite_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_favorite_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_by_date**
> get_foods_by_date(\_date)
Get Food Logs
Retreives a summary and list of a user's food log entries for a given day in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Food Logs
api_instance.get_foods_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_goal**
> get_foods_goal()
Get Food Goals
Returns a user's current daily calorie consumption goal and/or foodPlan value in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Goals
api_instance.get_foods_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_info**
> get_foods_info(food_id)
Get Food
Returns the details of a specific food in the Fitbit food databases or a private food that an authorized user has entered in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
food_id = 'food_id_example' str | The ID of the food.
try:
Get Food
api_instance.get_foods_info(food_id)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_info: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ----------- | ------- | ------------------- | ----- |
| **food_id** | **str** | The ID of the food. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_list**
> get_foods_list(query)
Search Foods
Returns a list of public foods from the Fitbit food database and private food the user created in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
query = 'query_example' str | The URL-encoded search query.
try:
Search Foods
api_instance.get_foods_list(query)
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_list: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------------------------- | ----- |
| **query** | **str** | The URL-encoded search query. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_locales**
> get_foods_locales()
Get Food Locales
Returns the food locales that the user may choose to search, log, and create food in.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Locales
api_instance.get_foods_locales()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_locales: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_foods_units**
> get_foods_units()
Get Food Units
Returns a list of all valid Fitbit food units in the format requested.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Food Units
api_instance.get_foods_units()
except ApiException as e:
print("Exception when calling NutritionApi->get_foods_units: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_frequent_foods**
> get_frequent_foods()
Get Frequent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Frequent Foods
api_instance.get_frequent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_frequent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_meals**
> get_meals()
Get Meals
Returns a list of meals created by user in the user's food log in the format requested. User creates and manages meals on the Food Log tab on the website.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Meals
api_instance.get_meals()
except ApiException as e:
print("Exception when calling NutritionApi->get_meals: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_recent_foods**
> get_recent_foods()
Get Recent Foods
Returns a list of a user's frequent foods in the format requested. A frequent food in the list provides a quick way to log the food via the Log Food endpoint.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Recent Foods
api_instance.get_recent_foods()
except ApiException as e:
print("Exception when calling NutritionApi->get_recent_foods: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_by_date**
> get_water_by_date(\_date)
Get Water Logs
Retreives a summary and list of a user's water log entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date of records to be returned. In the format yyyy-MM-dd.
try:
Get Water Logs
api_instance.get_water_by_date(_date)
except ApiException as e:
print("Exception when calling NutritionApi->get_water_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date of records to be returned. In the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_water_goal**
> get_water_goal()
Get Water Goal
Retreives a summary and list of a user's water goal entries for a given day in the requested using units in the unit system that corresponds to the Accept-Language header provided.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
try:
Get Water Goal
api_instance.get_water_goal()
except ApiException as e:
print("Exception when calling NutritionApi->get_water_goal: %s\n" % e)
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_meal**
> update_meal(body)
Update Meal
Replaces an existing meal with the contents of the request. The response contains the updated meal.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
body = fitbit_web_api.Meal() Meal | Meal to create
try:
Update Meal
api_instance.update_meal(body)
except ApiException as e:
print("Exception when calling NutritionApi->update_meal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| -------- | ------------------- | -------------- | ----- |
| **body** | [**Meal**](Meal.md) | Meal to create |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_water_log**
> update_water_log(water_log_id, amount, unit=unit)
Update Water Log
Updates a user's water log entry with the given ID.
Example
python
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.NutritionApi(fitbit_web_api.ApiClient(configuration))
water_log_id = 'water_log_id_example' str | The ID of the waterUnit log entry to be deleted.
amount = 'amount_example' str | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided.
unit = 'unit_example' str | Water measurement unit. 'ml', 'fl oz', or 'cup'. (optional)
try:
Update Water Log
api_instance.update_water_log(water_log_id, amount, unit=unit)
except ApiException as e:
print("Exception when calling NutritionApi->update_water_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- |
| **water_log_id** | **str** | The ID of the waterUnit log entry to be deleted. |
| **amount** | **str** | Amount consumed; in the format X.X and in the specified waterUnit or in the unit system that corresponds to the Accept-Language header provided. |
| **unit** | **str** | Water measurement unit. &x27;ml&x27;, &x27;fl oz&x27;, or &x27;cup&x27;. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
fitbit_web_api.BodyApi
All URIs are relative to *https://api.fitbit.com/*
| Method | HTTP request | Description |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------ | -------------------- |
| [**add_body_fat_log**](BodyApi.mdadd_body_fat_log) | **POST** /1/user/-/body/log/fat.json | Log Body Fat |
| [**add_weight_log**](BodyApi.mdadd_weight_log) | **POST** /1/user/-/body/log/weight.json | Log Weight |
| [**delete_body_fat_log**](BodyApi.mddelete_body_fat_log) | **DELETE** /1/user/-/body/log/fat/{body-fat-log-id}.json | Delete Body Fat Log |
| [**delete_weight_log**](BodyApi.mddelete_weight_log) | **DELETE** /1/user/-/body/log/weight/{body-weight-log-id}.json | Delete Weight Log |
| [**get_body_fat_by_date**](BodyApi.mdget_body_fat_by_date) | **GET** /1/user/-/body/log/fat/date/{date}.json | Get Body Fat Logs |
| [**get_body_fat_by_date_period**](BodyApi.mdget_body_fat_by_date_period) | **GET** /1/user/-/body/log/fat/date/{date}/{period}.json | Get Body Fat Logs |
| [**get_body_fat_by_date_range**](BodyApi.mdget_body_fat_by_date_range) | **GET** /1/user/-/body/log/fat/date/{base-date}/{end-date}.json | Get Body Fat Logs |
| [**get_body_goals**](BodyApi.mdget_body_goals) | **GET** /1/user/-/body/log/{goal-type}/goal.json | Get Body Goals |
| [**get_weight_by_date**](BodyApi.mdget_weight_by_date) | **GET** /1/user/-/body/log/weight/date/{date}.json | Get Weight Logs |
| [**get_weight_by_date_period**](BodyApi.mdget_weight_by_date_period) | **GET** /1/user/-/body/log/weight/date/{date}/{period}.json | Get Body Fat Logs |
| [**get_weight_by_date_range**](BodyApi.mdget_weight_by_date_range) | **GET** /1/user/-/body/log/weight/date/{base-date}/{end-date}.json | Get Body Fat Logs |
| [**update_body_fat_goal**](BodyApi.mdupdate_body_fat_goal) | **POST** /1/user/-/body/log/fat/goal.json | Update Body Fat Goal |
| [**update_weight_goal**](BodyApi.mdupdate_weight_goal) | **POST** /1/user/-/body/log/weight/goal.json | Update Weight Goal |
**add_body_fat_log**
> add_body_fat_log(fat, \_date, time)
Log Body Fat
Creates a log entry for body fat and returns a response in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
fat = 56 int | Body fat in the format of X.XX in the unit system that corresponds to the Accept-Language header provided.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
time = 'time_example' str | Time of the measurement in hours and minutes in the format HH:mm:ss that is set to the last second of the day if not provided.
try:
Log Body Fat
api_instance.add_body_fat_log(fat, _date, time)
except ApiException as e:
print("Exception when calling BodyApi->add_body_fat_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ | ----- |
| **fat** | **int** | Body fat in the format of X.XX in the unit system that corresponds to the Accept-Language header provided. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **time** | **str** | Time of the measurement in hours and minutes in the format HH:mm:ss that is set to the last second of the day if not provided. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**add_weight_log**
> add_weight_log(weight, \_date, time=time)
Log Weight
Creates log entry for a body weight using units in the unit systems that corresponds to the Accept-Language header provided and gets a response in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
weight = 56 int | Weight in the format of X.XX.
_date = '2013-10-20' date | Log entry date in the format yyyy-MM-dd.
time = 'time_example' str | Time of the measurement; hours and minutes in the format of HH:mm:ss, which is set to the last second of the day if not provided. (optional)
try:
Log Weight
api_instance.add_weight_log(weight, _date, time=time)
except ApiException as e:
print("Exception when calling BodyApi->add_weight_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **weight** | **int** | Weight in the format of X.XX. |
| **\_date** | **date** | Log entry date in the format yyyy-MM-dd. |
| **time** | **str** | Time of the measurement; hours and minutes in the format of HH:mm:ss, which is set to the last second of the day if not provided. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_body_fat_log**
> delete_body_fat_log(body_fat_log_id)
Delete Body Fat Log
Deletes a user's body fat log entry with the given ID.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
body_fat_log_id = 56 int | The ID of the body fat log entry.
try:
Delete Body Fat Log
api_instance.delete_body_fat_log(body_fat_log_id)
except ApiException as e:
print("Exception when calling BodyApi->delete_body_fat_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------------- | ------- | --------------------------------- | ----- |
| **body_fat_log_id** | **int** | The ID of the body fat log entry. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**delete_weight_log**
> delete_weight_log(body_weight_log_id)
Delete Weight Log
Deletes a user's body weight log entrywith the given ID.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
body_weight_log_id = 56 int | The ID of the body weight log entry.
try:
Delete Weight Log
api_instance.delete_weight_log(body_weight_log_id)
except ApiException as e:
print("Exception when calling BodyApi->delete_weight_log: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------------- | ------- | ------------------------------------ | ----- |
| **body_weight_log_id** | **int** | The ID of the body weight log entry. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_fat_by_date**
> get_body_fat_by_date(\_date)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
try:
Get Body Fat Logs
api_instance.get_body_fat_by_date(_date)
except ApiException as e:
print("Exception when calling BodyApi->get_body_fat_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ---------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_fat_by_date_period**
> get_body_fat_by_date_period(\_date, period)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
period = 'period_example' str | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max.
try:
Get Body Fat Logs
api_instance.get_body_fat_by_date_period(_date, period)
except ApiException as e:
print("Exception when calling BodyApi->get_body_fat_by_date_period: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ----------------------------------------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
| **period** | **str** | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_fat_by_date_range**
> get_body_fat_by_date_range(base_date, end_date)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
base_date = '2013-10-20' date | The range start date in the format yyyy-MM-dd or today.
end_date = '2013-10-20' date | The end date of the range.
try:
Get Body Fat Logs
api_instance.get_body_fat_by_date_range(base_date, end_date)
except ApiException as e:
print("Exception when calling BodyApi->get_body_fat_by_date_range: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------- | -------- | ------------------------------------------------------- | ----- |
| **base_date** | **date** | The range start date in the format yyyy-MM-dd or today. |
| **end_date** | **date** | The end date of the range. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_body_goals**
> get_body_goals(goal_type)
Get Body Goals
Retreives a user's current body fat percentage or weight goal using units in the unit systems that corresponds to the Accept-Language header providedin the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
goal_type = 'goal_type_example' str | weight or fat.
try:
Get Body Goals
api_instance.get_body_goals(goal_type)
except ApiException as e:
print("Exception when calling BodyApi->get_body_goals: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------- | ------- | -------------- | ----- |
| **goal_type** | **str** | weight or fat. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_weight_by_date**
> get_weight_by_date(\_date)
Get Weight Logs
Retreives a list of all user's body weight log entries for a given day using units in the unit systems which corresponds to the Accept-Language header provided.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
try:
Get Weight Logs
api_instance.get_weight_by_date(_date)
except ApiException as e:
print("Exception when calling BodyApi->get_weight_by_date: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ---------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_weight_by_date_period**
> get_weight_by_date_period(\_date, period)
Get Body Fat Logs
Retreives a list of all user's body weight log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
_date = '2013-10-20' date | The date in the format yyyy-MM-dd.
period = 'period_example' str | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max.
try:
Get Body Fat Logs
api_instance.get_weight_by_date_period(_date, period)
except ApiException as e:
print("Exception when calling BodyApi->get_weight_by_date_period: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------- | -------- | ----------------------------------------------------------------------------------------------- | ----- |
| **\_date** | **date** | The date in the format yyyy-MM-dd. |
| **period** | **str** | The range for which data will be returned. Options are 1d, 7d, 30d, 1w, 1m, 3m, 6m, 1y, or max. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**get_weight_by_date_range**
> get_weight_by_date_range(base_date, end_date)
Get Body Fat Logs
Retreives a list of all user's body fat log entries for a given day in the format requested.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
base_date = '2013-10-20' date | The range start date in the format yyyy-MM-dd or today.
end_date = '2013-10-20' date | The end date of the range.
try:
Get Body Fat Logs
api_instance.get_weight_by_date_range(base_date, end_date)
except ApiException as e:
print("Exception when calling BodyApi->get_weight_by_date_range: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------------- | -------- | ------------------------------------------------------- | ----- |
| **base_date** | **date** | The range start date in the format yyyy-MM-dd or today. |
| **end_date** | **date** | The end date of the range. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_body_fat_goal**
> update_body_fat_goal(fat)
Update Body Fat Goal
Updates user's fat percentage goal.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
fat = 'fat_example' str | Target body fat percentage; in the format X.XX.
try:
Update Body Fat Goal
api_instance.update_body_fat_goal(fat)
except ApiException as e:
print("Exception when calling BodyApi->update_body_fat_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ------- | ------- | ----------------------------------------------- | ----- |
| **fat** | **str** | Target body fat percentage; in the format X.XX. |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)
**update_weight_goal**
> update_weight_goal(start_date, start_weight, weight=weight)
Update Weight Goal
Updates user's fat percentage goal.
Example
python
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.BodyApi(fitbit_web_api.ApiClient(configuration))
start_date = 'start_date_example' str | Weight goal start date; in the format yyyy-MM-dd.
start_weight = 'start_weight_example' str | Weight goal start weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided.
weight = 'weight_example' str | Weight goal target weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided; required if user doesn't have an existing weight goal. (optional)
try:
Update Weight Goal
api_instance.update_weight_goal(start_date, start_weight, weight=weight)
except ApiException as e:
print("Exception when calling BodyApi->update_weight_goal: %s\n" % e)
Parameters
| Name | Type | Description | Notes |
| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| **start_date** | **str** | Weight goal start date; in the format yyyy-MM-dd. |
| **start_weight** | **str** | Weight goal start weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided. |
| **weight** | **str** | Weight goal target weight; in the format X.XX, in the unit systems that corresponds to the Accept-Language header provided; required if user doesn&x27;t have an existing weight goal. | [optional] |
Return type
void (empty response body)
Authorization
[oauth2](../README.mdoauth2)
HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]]() [[Back to API list]](../README.mddocumentation-for-api-endpoints) [[Back to Model list]](../README.mddocumentation-for-models) [[Back to README]](../README.md)