Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Breaking change to Get Activity Logs List

ANSWERED

2016-04-26 update: Please see known issues here.

 

2016-04-19 5:00 PM PDT update: This change is now live.

 

2015-04-18 update: We're delaying the release one day.

 

Original post below.

—————

 

Fitbit will be make breaking changes to the Get Activity Logs List endpoint. As this endpoint is in beta, it will not follow our 30 day breaking change policy. These changes will be released on Tuesday, April 19th.

 

This endpoint is how applications can retrieve all types of activity logs. The type of activity log can be determined by the “logType” property.

  • “auto_detected” activity logs are those created by Fitbit’s SmartTrack feature.
  • “fitstar” activity logs are created after completing a FitStar workout.
  • “manual” activity logs override some or all tracker data.
  • “mobile_run” activity logs are created after completing a MobileRun.
  • “tracker” activity logs are those created using the exercise mode on a Fitbit device.

 

For more information about each type of activity log type, see the help article “How do I track my exercise and activities with Fitbit?”.

 

Pagination is date based. For activity logs descending by date, use sort=desc and beforeDate. For ascending by date, use sort=asc and afterDate. You can request up to 10 exercise logs at a time.

 

Here is an example response for the request https://api.fitbit.com/1/user/-/activities/list.json?beforeDate=2015-03-30&sort=desc&limit=10:

{
    "activities": [{
        "activeDuration": 1734000,
        "activityLevel": [{
            "minutes": 4,
            "name": "sedentary"
        }, {
            "minutes": 14,
            "name": "lightly"
        }, {
            "minutes": 4,
            "name": "fairly"
        }, {
            "minutes": 6,
            "name": "very"
        }],
        "activityName": "FitStar: Personal Trainer",
        "activityTypeId": 17589491,
        "averageHeartRate": 94,
        "calories": 136,
        "caloriesLink": "https://api.fitbit.com/1/user/-/activities/calories/date/2016-03-29/2016-03-29/1min/time/8:45/9:13.json",
        "distance": 1.071811,
        "distanceUnit": "Kilometer",
        "duration": 1734000,
        "heartRateLink": "https://api.fitbit.com/1/user/-/activities/heart/date/2016-03-29/2016-03-29/1sec/time/08:45:00/09:13:54.json",
        "heartRateZones": [{
            "max": 94,
            "min": 30,
            "minutes": 16,
            "name": "Out of Range"
        }, {
            "max": 131,
            "min": 94,
            "minutes": 9,
            "name": "Fat Burn"
        }, {
            "max": 159,
            "min": 131,
            "minutes": 1,
            "name": "Cardio"
        }, {
            "max": 220,
            "min": 159,
            "minutes": 0,
            "name": "Peak"
        }],
        "lastModified": "2016-03-29T17:41:53.000Z",
        "logId": 2067350363,
        "logType": "fitstar",
        "manualValuesSpecified": {
            "calories": false,
            "distance": false,
            "steps": false
        },
        "source": {
            "id": "228T4Z",
            "name": "FitStar",
            "type": "app",
            "url": "http://www.fitstar.com"
        },
        "speed": 2.2252131487889275,
        "startTime": "2016-03-29T08:45:00.000-07:00",
        "steps": 1354
    }, {
        "activeDuration": 1001000,
        "activityLevel": [{
            "minutes": 0,
            "name": "sedentary"
        }, {
            "minutes": 0,
            "name": "lightly"
        }, {
            "minutes": 17,
            "name": "fairly"
        }, {
            "minutes": 0,
            "name": "very"
        }],
        "activityName": "Bike",
        "activityTypeId": 90001,
        "averageHeartRate": 93,
        "calories": 77,
        "caloriesLink": "https://api.fitbit.com/1/user/-/activities/calories/date/2016-03-28/2016-03-28/1min/time/19:05/19:22.json",
        "distance": 4.1978,
        "distanceUnit": "Kilometer",
        "duration": 1001000,
        "heartRateLink": "https://api.fitbit.com/1/user/-/activities/heart/date/2016-03-28/2016-03-28/1sec/time/19:05:31/19:22:12.json",
        "heartRateZones": [{
            "max": 94,
            "min": 30,
            "minutes": 7,
            "name": "Out of Range"
        }, {
            "max": 131,
            "min": 94,
            "minutes": 10,
            "name": "Fat Burn"
        }, {
            "max": 159,
            "min": 131,
            "minutes": 0,
            "name": "Cardio"
        }, {
            "max": 220,
            "min": 159,
            "minutes": 0,
            "name": "Peak"
        }],
        "lastModified": "2016-03-29T03:03:12.000Z",
        "logId": 2068007929,
        "logType": "manual",
        "manualValuesSpecified": {
            "calories": true,
            "distance": true,
            "steps": true
        },
        "source": {
            "id": "22997K",
            "name": "Fitbit + Strava",
            "type": "app",
            "url": "https://strava.fitbit.com/"
        },
        "speed": 15.096983016983017,
        "startTime": "2016-03-28T19:05:31.000-07:00",
        "steps": 0
    }, {
        "activeDuration": 1503000,
        "activityLevel": [{
            "minutes": 4,
            "name": "sedentary"
        }, {
            "minutes": 11,
            "name": "lightly"
        }, {
            "minutes": 3,
            "name": "fairly"
        }, {
            "minutes": 7,
            "name": "very"
        }],
        "activityName": "Walk",
        "activityTypeId": 90013,
        "averageHeartRate": 96,
        "calories": 134,
        "caloriesLink": "https://api.fitbit.com/1/user/-/activities/calories/date/2016-03-26/2016-03-26/1min/time/14:49/15:14.json",
        "duration": 1503000,
        "heartRateLink": "https://api.fitbit.com/1/user/-/activities/heart/date/2016-03-26/2016-03-26/1sec/time/14:49:05/15:14:08.json",
        "heartRateZones": [{
            "max": 94,
            "min": 30,
            "minutes": 8,
            "name": "Out of Range"
        }, {
            "max": 131,
            "min": 94,
            "minutes": 17,
            "name": "Fat Burn"
        }, {
            "max": 159,
            "min": 131,
            "minutes": 0,
            "name": "Cardio"
        }, {
            "max": 220,
            "min": 159,
            "minutes": 0,
            "name": "Peak"
        }],
        "lastModified": "2016-03-26T22:34:17.000Z",
        "logId": 2047712815,
        "logType": "auto_detected",
        "manualValuesSpecified": {
            "calories": false,
            "distance": false,
            "steps": false
        },
        "startTime": "2016-03-26T14:49:05.000-07:00",
        "steps": 1662
    }, {
        "activeDuration": 2766000,
        "activityLevel": [{
            "minutes": 5,
            "name": "sedentary"
        }, {
            "minutes": 6,
            "name": "lightly"
        }, {
            "minutes": 2,
            "name": "fairly"
        }, {
            "minutes": 33,
            "name": "very"
        }],
        "activityName": "Workout",
        "activityTypeId": 3000,
        "averageHeartRate": 147,
        "calories": 416,
        "caloriesLink": "https://api.fitbit.com/1/user/-/activities/calories/date/2016-03-05/2016-03-05/1min/time/15:31/16:17.json",
        "duration": 2766000,
        "heartRateLink": "https://api.fitbit.com/1/user/-/activities/heart/date/2016-03-05/2016-03-05/1sec/time/15:31:17/16:17:23.json",
        "heartRateZones": [{
            "max": 94,
            "min": 30,
            "minutes": 3,
            "name": "Out of Range"
        }, {
            "max": 131,
            "min": 94,
            "minutes": 8,
            "name": "Fat Burn"
        }, {
            "max": 159,
            "min": 131,
            "minutes": 4,
            "name": "Cardio"
        }, {
            "max": 220,
            "min": 159,
            "minutes": 30,
            "name": "Peak"
        }],
        "lastModified": "2016-03-06T00:20:21.000Z",
        "logId": 1846159807,
        "logType": "tracker",
        "manualValuesSpecified": {
            "calories": false,
            "distance": false,
            "steps": false
        },
        "source": {
            "id": "47086726",
            "name": "Charge HR",
            "type": "tracker",
            "url": "https://www.fitbit.com/"
        },
        "startTime": "2016-03-05T15:31:17.000-08:00",
        "steps": 683,
        "tcxLink": "https://api.fitbit.com/1/user/-/activities/1846159807.json"
    }, {
        "activeDuration": 784739,
        "activityLevel": [{
            "minutes": 0,
            "name": "sedentary"
        }, {
            "minutes": 1,
            "name": "lightly"
        }, {
            "minutes": 0,
            "name": "fairly"
        }, {
            "minutes": 12,
            "name": "very"
        }],
        "activityName": "Run",
        "activityTypeId": 90009,
        "averageHeartRate": 125,
        "calories": 124,
        "caloriesLink": "https://api.fitbit.com/1/user/-/activities/calories/date/2016-01-31/2016-01-31/1min/time/19:11/19:24.json",
        "distance": 2.534752,
        "distanceUnit": "Kilometer",
        "duration": 784000,
        "heartRateLink": "https://api.fitbit.com/1/user/-/activities/heart/date/2016-01-31/2016-01-31/1sec/time/19:11:49/19:24:53.json",
        "heartRateZones": [{
            "max": 94,
            "min": 30,
            "minutes": 2,
            "name": "Out of Range"
        }, {
            "max": 131,
            "min": 94,
            "minutes": 1,
            "name": "Fat Burn"
        }, {
            "max": 159,
            "min": 131,
            "minutes": 10,
            "name": "Cardio"
        }, {
            "max": 220,
            "min": 159,
            "minutes": 0,
            "name": "Peak"
        }],
        "lastModified": "2016-02-01T03:25:03.000Z",
        "logId": 1546680089,
        "logType": "mobile_run",
        "manualValuesSpecified": {
            "calories": false,
            "distance": false,
            "steps": false
        },
        "pace": 309.30047594399764,
        "source": {
            "id": "2295XJ",
            "name": "Fitbit for Windows Phone",
            "type": "app",
            "url": "https://www.fitbit.com/"
        },
        "speed": 11.628206575689497,
        "startTime": "2016-01-31T19:11:49.000-08:00",
        "steps": 1827,
        "tcxLink": "https://api.fitbit.com/1/user/-/activities/1546680089.json"
    }, {
        "activeDuration": 6226000,
        "activityLevel": [{
            "minutes": 6,
            "name": "sedentary"
        }, {
            "minutes": 37,
            "name": "lightly"
        }, {
            "minutes": 28,
            "name": "fairly"
        }, {
            "minutes": 32,
            "name": "very"
        }],
        "activityName": "Hike",
        "activityTypeId": 90012,
        "averageHeartRate": 102,
        "calories": 582,
        "caloriesLink": "https://api.fitbit.com/1/user/-/activities/calories/date/2015-05-25/2015-05-25/1min/time/14:08/16:09.json",
        "distance": 5.600688,
        "distanceUnit": "Kilometer",
        "duration": 7272000,
        "heartRateLink": "https://api.fitbit.com/1/user/-/activities/heart/date/2015-05-25/2015-05-25/1sec/time/14:08:12/16:09:24.json",
        "heartRateZones": [{
            "max": 94,
            "min": 30,
            "minutes": 24,
            "name": "Out of Range"
        }, {
            "max": 132,
            "min": 94,
            "minutes": 79,
            "name": "Fat Burn"
        }, {
            "max": 160,
            "min": 132,
            "minutes": 0,
            "name": "Cardio"
        }, {
            "max": 220,
            "min": 160,
            "minutes": 0,
            "name": "Peak"
        }],
        "lastModified": "2015-07-15T23:45:47.000Z",
        "logId": 228167717,
        "logType": "tracker",
        "manualValuesSpecified": {
            "calories": false,
            "distance": false,
            "steps": false
        },
        "pace": 1111.6491402484837,
        "source": {
            "id": "18834976",
            "name": "Surge",
            "type": "tracker",
            "url": "https://www.fitbit.com/"
        },
        "speed": 3.2384318663668488,
        "startTime": "2015-05-25T14:08:12.000-07:00",
        "steps": 7295,
        "tcxLink": "https://api.fitbit.com/1/user/-/activities/228167717.json"
    }],
    "pagination": {
        "beforeDate": "2016-03-30",
        "limit": 10,
        "next": "https://api.fitbit.com/1/user/-/activities/list.json?limit=10&sort=desc&beforeDate=2015-07-15T23:45:47.000Z",
        "sort": "desc"
    }
}

 

Best Answer
60 REPLIES 60

@ejain wrote:

The distance value appears to have an explicit distanceUnit (presumably this reflects the value of the Accept-Language header), but what are the units for the speed and pace values?


Speed: Kilometers or miles traveled in an hour, like driving (e.g. running at 13.7 kilometers per hour)

Pace: Time it takes to complete a kilometer or mile (e.g. 4:20 = running a kilometer in 4 minutes 20 seconds)

Best Answer

We're delaying the release one day. It should be available on Tuesday, April 19, 2016.

Best Answer
0 Votes
Are we there yet? 🙂
Eric Jain
Got data? Get answers at zenobase.com.
Best Answer
0 Votes

This change is now live. Updated documentation is at https://dev.fitbit.com/docs/activity/#get-activity-logs-list

Best Answer

Hi, I can get the activity logs list, but it is missing heart rate data, why?

 

This is my logs list :

{"activities":[{"activeDuration":124000,"activityLevel":[{"minutes":2,"name":"sedentary"},{"minutes":0,"name":"lightly"},{"minutes":0,"name":"fairly"},{"minutes":0,"name":"very"}],"activityName":"Run","activityTypeId":90009,"calories":2,"distance":0,"distanceUnit":"Kilometer","duration":139000,"lastModified":"2016-04-19T10:37:30.000Z","logId":2295916380,"logType":"tracker","manualValuesSpecified":{"calories":false,"distance":false,"steps":false},"source":{"id":"62781531","name":"Surge","type":"tracker","url":"https://www.fitbit.com/"},"speed":0,"startTime":"2016-04-19T17:43:33.000+08:00","steps":0,"tcxLink":...

Best Answer

This endpoint does not seem to be returning "Activity Records" - those entered by clicking the Clock+ icon on https://www.fitbit.com/activities and entering the Name, Date, Start, and End time.

 

It's also not clear which of the logTypes such activities would fall under - they are technically "manual" but don't really override any tracker collected data.

Best Answer
0 Votes

@BenNg wrote:

Hi, I can get the activity logs list, but it is missing heart rate data, why?


Heart rate data will only be returned if you have the `heartrate` OAuth 2.0 scope.

Best Answer
0 Votes

I can confirm this also.

Best Answer
0 Votes

@BigR wrote:

This endpoint does not seem to be returning "Activity Records" - those entered by clicking the Clock+ icon on https://www.fitbit.com/activities and entering the Name, Date, Start, and End time.

 

It's also not clear which of the logTypes such activities would fall under - they are technically "manual" but don't really override any tracker collected data.


@BigR: At this time, those records are not returned. This is an uncommonly used legacy feature that is only available in the Fitbit Web app. I will relay this feature request internally.

Best Answer
Can confirm, there's no averageHeartRate, even when using a token that has the heartrate scope (and that is used to retrieve heart rate data through other endpoints).
Eric Jain
Got data? Get answers at zenobase.com.
Best Answer
0 Votes

Update: this issue is now fixed.

—————

We have confirmed the issue with heart rate data not being returned. It will be fixed within the next week. Thank you for the reports.

 

 

Best Answer

Hello,

 

I am a bit confused by the notation of startTime. In the sample you provided (and in reality as well) it includes time zone. So, it actually defines a particular moment in time which can be unambiguously converted to a Unix timestamp. However, when an activity is logged, it is not possible to specify the time zone, i. e. (as explained here) the date & time do not define a particular moment in time in this case, but rather they define just "whatever time the person's device states". Here is an example of when it becomes a problem:

 

  1. I am in Prague, so say I log an activity at 2016-04-25 21:37:00. It's 2016-04-25 19:37:00 UTC.
  2. I query my activities and get back an activity with startTime as 2016-04-25T21:37:00.000Z (note the Z, which clearly identifies the time zone as Zulu time or UTC).
  3. I render the latter value in local time and get 2016-04-25 23:37:00, which is not what I originally input.

 

I can just strip the Z (or any other time zone info for that matter) before parsing the startTime, but this is just a dirty hack and can lead to problems as well.

 

So, what would you suggest to work around this problem?

 

Thank you in advance.

Best Answer
0 Votes

@stepank: That is definitely a bug. I have confirmed the behavior. I will relay it internally. Thank you for the report.

Best Answer
0 Votes

In the activity data I've seen so far, the startTime always had the correct time zone offsets, but I haven't done any extensive testing...

 

Do you know how the activities with the incorrect startTimes were recorded (e.g. auto_detected, or manual through one of the apps)?

 

Eric Jain
Got data? Get answers at zenobase.com.
Best Answer
0 Votes

@JeremiahFitbit: Thank you, do you think I should just wait for a short while until the fix is released, or is there anything else you would recommend for now? Will you post a message here once this is fixed?

Best Answer
0 Votes

It appears to only be an issue with manually logged entries from third-party apps or Fitbit's Web app (but not Fitbit's mobile apps).

Best Answer
0 Votes

Just to clarify, above you have said that the maximum number of exercise logs you can request is 10, but I noticed the API says 20 under the limit parameter here: https://dev.fitbit.com/docs/activity/#get-activity-logs-list.  Which is correct?  I haven't been able to test it myself yet.  Thanks!

Best Answer
0 Votes

@rMirage: The documentation is correct.

Best Answer
0 Votes

@JeremiahFitbit: Yes, that's exactly my case, manually logged entries from a third party app. So, what would you recommend to do?

Best Answer
0 Votes

@stepank: This is more complicated than it might seem and will involve multiple fixes.

 

For now, you should consider timestamps of manually created activity logs from apps other than Fitbit's mobile apps to have the incorrect timezone. The work around is to ignore the Z/UTC declaration and assume the user's local time zone (listed in the profile endpoint) instead. This is functionally equivalent to fetching the manually logged activities from the Get Daily Activity Summary endpoint, which does not return time zone.

 

Within the next 3 weeks, newly created manual activity logs will be saved with the user's timezone setting as of the time of creation. We will announce when this fix is released.

 

Within the next few months, we will update existing manual activity logs to have the timezone matching the tracker data synced at that time. If there is no tracker data for that time period, the user's timezone setting as of the migration will be used. We will announce when this update starts and ends.

Best Answer