05-26-2016 08:45
05-26-2016 08:45
Hi,
I have a question on the values and the Units returned in the API response.
In my Get User Profile response, I am getting the weight in Kgs instead of lbs whereas the weight unit is en_US.Same is for height, I am getting height in cms instead of inches. I am following the Unit Conversion documentation , as per the documentation if the Locale is en_US then the weight should be in lbs and height in inches. I guess, I am getting the values in Metric system. But the locale is en_US. Here is the example snippet.
weight = "56.2";
weightUnit = "en_US";
height = "157.5";
heightUnit = "en_US";
locale = "en_US";
Is there something I am missing?
Answered! Go to the Best Answer.
05-26-2016 11:12 - edited 05-26-2016 15:34
05-26-2016 11:12 - edited 05-26-2016 15:34
@ektay I can see why that can be confusing.
weightUnit refers to what the units are set to on the user's profile. Setting the Accept-Language won't change the weightUnit, it will only change the value of "weight" (e.g. 'en_GB' should return the weight value in stones).
So in the settings of the user's Fitbit.com profile:
If 'Weight' = 'Pounds' then weightUnit = 'en_US'
If 'Weight' = 'Stones' then weightUnit = 'en_GB'
If 'Weight' = 'Kilograms' then weightUnit = 'METRIC'
You can ignore weightUnit if you want, it's just telling you what the user has their units set to. Hope that helps clarify.
05-26-2016 09:18
05-26-2016 09:18
@ektay Yeah that means the units are set to en_US on the profile, but the API returns metric by default unless you set the Accept-Language to "en_US" in the header.
05-26-2016 09:49
05-26-2016 09:49
Thanks for the response.
The unit Key Value pair is confusing. If Fitbit is sending me the value in Metric shouldn't it send the unit as METRIC?
If I set the "en_UK" or "en_GB" in "Accept-Language" header I get the same response.
weight = "56.2";
weightUnit = "en_US";
Should I be ignoring weightUnit, HeightUnit all together? Any plans to fix this?
05-26-2016 11:12 - edited 05-26-2016 15:34
05-26-2016 11:12 - edited 05-26-2016 15:34
@ektay I can see why that can be confusing.
weightUnit refers to what the units are set to on the user's profile. Setting the Accept-Language won't change the weightUnit, it will only change the value of "weight" (e.g. 'en_GB' should return the weight value in stones).
So in the settings of the user's Fitbit.com profile:
If 'Weight' = 'Pounds' then weightUnit = 'en_US'
If 'Weight' = 'Stones' then weightUnit = 'en_GB'
If 'Weight' = 'Kilograms' then weightUnit = 'METRIC'
You can ignore weightUnit if you want, it's just telling you what the user has their units set to. Hope that helps clarify.