09-05-2019 11:01
09-05-2019 11:01
Hi,
We're trying to fetch cycling distance from Fitbit, but it's unclear if this is possible. We've reviewed past community posts and also reviewed web API documentation. Can someone help?
09-05-2019 16:13
09-05-2019 16:13
Hi @Devices1,
Welcome to the forums!
The Web API doesn't support the retrieval of data by activity type, unfortunately.
Using the GET Activity Time Series endpoints, you can extract overall distance in periods of 1d, 7d, 30d, 1w, 3m, 6m, or 1y. If you have Intraday access enabled on your app, can you retrieve distance in 1min detail levels for that day using the GET Activity Intraday Time Series endpoints
The only workaround I can think of is querying the GET Activity Logs List endpoint and pulling distance from any "Bike" or "Cycling" activities that are returned.
I hope this helps! Let me know if you have any additional questions.
09-06-2019 09:53
09-06-2019 09:53
Hi John,
Thank you for the reply. Please see my follow-up questions below in red:
Using the GET Activity Time Series endpoints, you can extract overall distance in periods of 1d, 7d, 30d, 1w, 3m, 6m, or 1y. If you have Intraday access enabled on your app, can you retrieve distance in 1min detail levels for that day using the GET Activity Intraday Time Series endpoints
The only workaround I can think of is querying the GET Activity Logs List endpoint and pulling distance from any "Bike" or "Cycling" activities that are returned.
Thanks!
09-06-2019 12:52
09-06-2019 12:52
@Devices1 You won't be able to tell the distance for activities logged with these endpoints. These endpoints pull overall distance data from all activities recorded on specific days and display them to you in the desired detail levels.
If you want to pull distance logged from a "Bike" ride, you would have to use the following endpoint and fill in the start/end time of when the bike activity took place, and you'll be returned with the distance data logged for that time period.
/1/user/-/activities/{resource-path}/date/{date}/1d/{detail-level}/time/{start-time}/{end-time}.json
resource-path=distance
date=YYYY-MM-DD
detail-level=1m or 15m
start-time=HH:MM (24h)
end-time=HH:MM (24h)
Example Query:
/1/user/-/activities/distance/date/2014-09-05/1d/1m/time/00:00/00:11}.json
Example response:
{
"activities-distance":[
{"dateTime":"2014-09-05","value":1433}
],
"activities-steps-intraday":{
"dataset":[
{"time":"00:00:00","value":0},
{"time":"00:01:00","value":0},
{"time":"00:02:00","value":0},
{"time":"00:03:00","value":0},
{"time":"00:04:00","value":0},
{"time":"00:05:00","value":287},
{"time":"00:06:00","value":287},
{"time":"00:07:00","value":287},
{"time":"00:08:00","value":287},
{"time":"00:09:00","value":287},
{"time":"00:10:00","value":0},
{"time":"00:11:00","value":0},
],
"datasetInterval":1,
"datasetType": "minute"
}
}
However, at this time, this endpoint is not behaving normally and is currently being looked into. The alternate solution would be to extract distance from "Bike" activities that are returned in the Get Activity Logs List endpoint.
Bike is a preset activity created by Fitbit that uses GPS to determine distance. There doesn't appear to be any preset "Cycling" activities on the app, but you can create a custom activity for it.
.
09-09-2019 06:57
09-09-2019 06:57
Thank you!
What is the timeline on this endpoint working properly?
09-09-2019 10:48
09-09-2019 10:48
@Devices1 The endpoint appears to be working fine right now, but if you see a different JSON response returned, please let me know. Thanks!