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

Missing distance for activity resource in Web API

The clarification is needed to understand when the distance property on /activity resource is missing. 

The distance is optionally included but the description is vague: "distance only included when it is relevant". Source: https://dev.fitbit.com/build/reference/web-api/activity/.

In our integration, we filter out only relevant activity types, such as running, walking, cycling. For each of those activity types, the distance seems to be very relevant, so we expected it to be always available. 


Many of our users complain that their activities are not synched on our platform. We investigated this issue deeply and narrow it down to missing distance for some activities. We assume that it might be related to the device type, .e.g. distance property might be included only if the Fitbit device has a built-in GPS. 


Please help us to educate our users when the distance property is available because lack of consistency and missing activities make our integration very unstable and unpredictable for the end-users. We're even willing to explicitly limit our integration to the devices that have a built-in GPS if that is possible.

Best Answer
0 Votes
5 REPLIES 5

Hi @krml 

 

The only reasons I can think of for why the distance is not being returned is either the device doesn't support distance or the activity doesn't support distance.  Can you provide me an example of a user who is not getting distance when it is expected?   Please post the device and the activityID of the exercise performed.

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Same problem here. Distance is given in json response of the API, but TCX endpoints says " <DistanceMeters>0.0</DistanceMeters>".

Would be great if this could be fixed soon. 

(@GordonFitbit   - You've got a message)

Best Answer
0 Votes

Hi @runalyze 

 

I'm assuming when you say "Distance is given in json response of the API" you mean the Get Daily Activity Summary or Get Activity Log List endpoints.   One thing to note about the TCX files is GPS data is required to see distance.   This means you need to have the location scope enabled AND an exercise that was recorded using on-device or connected GPS.   Without this information, distance will be returned as zero within the TCX endpoint.   See Get Activity TCX.  We do state this on the Get Activity TCX page, but we could clarify distance is returned for "tracker" exercises only.

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer

Hi @runalyze 

 

I've updated the content in the documentation regarding distance being returned for the TCX endpoint.   See Distance.   Hopefully, this helps clarify the situation better.

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer

Sorry, but there is no reason not to write the distance calculated via step size into the tcx file. 
Now you are writing 

" <DistanceMeters>0.0</DistanceMeters>" into the tcx file. Why don't you simply write the distance you have instead into it.

Best Answer
0 Votes