10-12-2016 00:15 - edited 10-17-2016 19:21
10-12-2016 00:15 - edited 10-17-2016 19:21
Anyone, please help.
We have set the Accept-Language to "en_US" in the header ['headers' => ['Accept-Language' => 'en_US'], ['Accept-Locale' => 'en_US']] to get the weight value in pounds if prefered by the user.
The problem is we're not getting the exact weight logged on Fitbit. For example, weight on Fitbit is 114.4 lbs, when we get the weight, it becomes 114.1 lbs. Another, 113.5 lbs, when synced becomes 113.3.
Is there something we're missing? It seems that the weight data we're getting is converted from lbs to kg and then to lbs again but didn't use the exact value in kg (since Fitbit data is rounded to 1 decimal place) when converted to lbs again.
10-12-2016 15:41
10-12-2016 15:41
@maria_920 wrote:
It seems that the weight data we're getting is converted from lbs to kg and then to lbs again but didn't use the exact value in kg
@maria_920 Are you converting back to kg somewhere? I would need more details because I'm not able to reproduce this. I'm able to pull correct weight values with my own profile using en_US.
Also, the value looks like it's being truncated, not rounded.
Example: 113.5 lbs is 51.482734 kg, but is shortened to 51.4, which converts back to 113.3 lbs.
10-12-2016 19:09
10-12-2016 19:09
Thanks for the reply.
No, we are not converting back to kg, we are just pulling the data from Fitbit. Here's the code:
$date_today = date("Y-m-d") ;
$endpoint = $provider->getBaseApiUrl() . "user/-/body/log/weight/date/" . $date_today ."." . FitBit::FORMAT_JSON;
if( $server_user['unit'] == 'metric'){
$request = $provider->getAuthenticatedRequest(
FitBit::METHOD_GET,
$endpoint,
$acc_token
);
}
else{
$request = $provider->getAuthenticatedRequest(
FitBit::METHOD_GET,
$endpoint,
$acc_token,
['headers' => ['Accept-Language' => 'en_US'], ['Accept-Locale' => 'en_US']]
);
}
$response = $provider->getResponse($request);
$fitbit_weight = $response['user']['weight'];
10-13-2016 14:48
10-13-2016 14:48
@maria_920 That's strange. I'd recommend submitting the form for API Support with as many details as possible, and any examples of affected user_ids.
10-17-2016 02:16 - edited 10-17-2016 02:49
10-17-2016 02:16 - edited 10-17-2016 02:49
@AndrewFitbit I failed to mention that we're doing the manual weight entry on the Fitbit ios app and test if the sync to our app is successful. It's just today that we tried to do the manual weight entry on the Fitbit web dashboard and we noticed that we're now getting the actual weight in lbs.
What's confusing is that when we logged 169.3 lbs via the ios app, the web dashboard also showed 169.3 lbs. But when synced to our app, it only shows 169 lbs. We tried to log 169.3 lbs directly to the web dashboard, we got the actual weight in lbs. It seems that the issue is logging via the ios app (we haven't tested it on android yet).
10-18-2016 10:29
10-18-2016 10:29
@maria_920 I still can't replicate what you're seeing; logged through both iOS and dashboard. The only noteable difference is that I'm not sending the weight value to an app. Is it possible that a conversion might be happening when you send the value to your app?