"Fitbit" (Service Connection)

Connect your Fitbit account to the Wolfram Language to analyze Fitbit data like steps, calories, sleep, and body measurements.

Connecting & Authenticating

    ServiceConnect["Fitbit"] creates a connection to the Fitbit API. If a previously saved connection can be found, it will be used; otherwise, a new authentication request will be launched.

Requests

    ServiceExecute["Fitbit","request",params] sends a request to the Fitbit API, using parameters params. The following give possible requests.

    User Data

    Requests:

    "UserData" information about the authenticated user

    Activity

    Requests:

    "ActivityData" activity on the specified date

    Parameters:
  • "Date"(required)activity date
  • Activity Time Series

    Requests:

    "MinutesVeryActiveTimeSeries" daily number of very active minutes

    "MinutesFairlyActiveTimeSeries" daily number of fairly active minutes

    "MinutesLightlyActiveTimeSeries"  ▪  "MinutesSedentaryTimeSeries"  ▪  "MinutesVeryActivePlot"  ▪  "MinutesFairlyActivePlot"  ▪  "MinutesLightlyActivePlot"  ▪  "MinutesSedentaryPlot"

    Parameters:
  • "StartDate"(required)beginning of time span
    "EndDate"(required)end of time span
  • Steps

    Requests:

    "StepsTimeSeries" daily number of steps taken

    "StepsPlot" plot of daily step totals

    "DistanceTimeSeries" daily total distance traveled

    "DistancePlot" plot of daily distance totals

    "ElevationTimeSeries"  ▪  "ElevationPlot"  ▪  "FloorsTimeSeries"  ▪  "FloorsPlot"

    Parameters:
  • "StartDate"(required)beginning of time span
    "EndDate"(required)end of time span
  • Calories and Food

    Requests:

    "FoodList" list of food consumed on the specified day

    Parameters:
  • "Date"(required)date
  • Calories and Food Time Series

    Requests:

    "CaloriesTimeSeries" daily number of calories burned

    "CaloriesInTimeSeries" daily calories consumed

    "CaloriesBMRTimeSeries" daily basal metabolic rate

    "ActivityCaloriesTimeSeries" daily calories burned during activities

    "CaloriesPlot"  ▪  "CaloriesInPlot"  ▪  "CaloriesBMRPlot"  ▪  "ActivityCaloriesPlot"  ▪  "WaterTimeSeries"  ▪  "WaterPlot"

    Parameters:
  • "StartDate"(required)beginning of time span
    "EndDate"(required)end of time span
  • Sleep

    Requests:

    "SleepData" sleep details for a given date

    Parameters:
  • "Date"(required)date
  • Sleep Time Series

    "SleepCalendar" a plot showing the user's sleep schedule and efficiency

    "SleepDensityTimeline" a 24-hour timeline showing the user's sleep pattern

    Parameters:
  • "StartDate"(required)beginning of time span
    "EndDate"(required)end of time span
  • Sleep Time Series

    "MinutesAsleepTimeSeries" daily minutes of sleep

    "MinutesAwakeTimeSeries" minutes spent awake in bed

    "TimeInBedTimeSeries" daily time spent in bed

    "SleepEfficiencyTimeSeries" daily sleep efficiency

    "BedTimes" a list of sleep starting times

    "MinutesAsleepPlot"  ▪  "MinutesAwakePlot"  ▪  "TimeInBedPlot"  ▪  "SleepEfficiencyPlot"  ▪  "AwakeningsCountTimeSeries"  ▪  "AwakeningCountPlot"  ▪  "MinutesAfterWakeupTimeSeries"  ▪  "MinutesAfterWakeupPlot"  ▪  "MinutesToFallAsleepTimeSeries"  ▪  "MinutesToFallAsleepPlot"  ▪  "SleepList"

    Parameters:
  • "StartDate"(required)beginning of time span
    "EndDate"(required)end of time span
  • Record Weight

    Requests:

    "RecordWeight" post a weight measurement

    Parameters:
  • "Date"(required)date
    "Weight"(required)users weight
  • Body Measurements Time Series

    Requests:

    "WeightTimeSeries" daily weight measurements

    "BMITimeSeries" daily body mass index calculation

    "BodyFatTimeSeries" daily body fat percentage

    "WeightPlot"  ▪  "BMIPlot"  ▪  "BodyFatPlot"

    Parameters:
  • "StartDate"(required)beginning of time span
    "EndDate"(required)end of time span

Examples

Basic Examples  (1)

Create a new connection by launching an authentication dialog:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Plot the total steps for each day in a range:

In[3]:=
Click for copyable input
Out[3]=

Get a time series of daily calories burned:

In[4]:=
Click for copyable input
Out[4]=

Create a moving average:

In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=

See Also

ServiceExecute  ▪  ServiceConnect  ▪  RunKeeper