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

Cycling - Can Fitbit Return Cycling Distance

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?

Best Answer
0 Votes
5 REPLIES 5

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.

Best Answer
0 Votes

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

    • How will we know the distance is for cycling?
  • 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.

    • Are "Bike" and "Cycling" system values to Fitbit or are they custom user defined values?

Thanks!

Best Answer
0 Votes

@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.

.

Best Answer
0 Votes

Thank you! 

 

What is the timeline on this endpoint working properly?

Best Answer
0 Votes

@Devices1 The endpoint appears to be working fine right now, but if you see a different JSON response returned, please let me know. Thanks!

Best Answer
0 Votes