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

Distance / Distance Unit Incorrect in return value

Hi there,


Our application will request the activities using en_GB in the header, which returns the following values as part of the response.

Looking at this data, the `distance` is in fact returned in km after checking the fitbit activity that matches this one, but the `distanceUnit` shows "Mile".

 

```
"activityName": "Walk",
"activityTypeId": 90013,
"averageHeartRate": 108,
"calories": 86,
"distance": 0.859961,
"distanceUnit": "Mile",
```

Is this expected?


We were using the `distanceUnit` to ensure we calculated our distance correctly assuming this would have come back matching the `distance`, but maybe that was an incorrect assumption to the `distanceUnit`'s intended purpose in this case?

Best Answer
5 REPLIES 5

Hi @frank.west.iii 

 

Would you please confirm what endpoint you're using?

 

Thanks!

Gordon

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

Sure thing Gordon. I was just about to test out whether or not this changes if I update my settings to use km whether or not this affects this return value.

 

https://api.fitbit.com/1/user/xxxxxx/activities/list.json?afterDate=2020-06-26&sort=asc&limit=20&off...

 

Headers being sent are {"Authorization"=>"Bearer xxxx", "Accept-Language"=>"en_GB"}

Best Answer
0 Votes

Just as a note, I changed my setting to be km on my device and the results are the same. I am getting the distance in km and the distanceUnit returns "Mile" still.

Best Answer

@frank.west.iii    Thank you for the additional testing and information.    Let me do some research on my end and get back with you.

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

Hi @Gordon-C - If someone configures their distance settings in their profile, does that take precedence? Here's an example scenario:

I'm in the US but I set my profile to use km

My research team pulls my data using the default localization (en_US)

Does the data return in km (because the profile's settings take precedence) or does the data get converted into miles (so the localization of the API pull takes precedence)?

 

Thanks!

Best Answer
0 Votes