Zn4rK / php-withings

PSR-FIG Compatible Withings Body metrics Services API written in PHP.
17 stars 14 forks source link

getMeasures with lastupdate params not working ? #23

Closed 4nti-7rust closed 6 years ago

4nti-7rust commented 7 years ago

Hi,

I thing the code will speak for me :

$params = array();
$params['lastupdate']   = '1513122315';

$api = new WithingsApi($config);

$user = $api->getUser();

echo 'Hello ' . $user->getFirstName() . '!<br>';
echo 'Here are your measures: <hr>';
foreach($user->getMeasures($params) as $measure) {
    echo $measure->getCreatedAt() . ': <br>';
    echo 'Weight       : ' . $measure->getWeight() . ' kg<br>';
    echo 'Fat ratio    : ' . $measure->getFatRatio() . ' %<br>';
    echo 'Muscle ratio : ' . $measure->getMuscleRatio() . ' %<br>';
    echo 'H²O ratio    : ' . $measure->getHydrationRatio() . ' %<br>';
    echo '<hr>';
}

lastupdate param is in the future (12 Dec 2017 23:45:15 GMT), I should received a null answer but I end up with all the available data. What am I missing ?

Withings doc about get measure and lastupdate param

EDIT : Note that doing the request by hand using http://oauth.withings.com/api and adding &lastupdate=1513122315 seems to work just fine. and give me : {"status":503,"error":"Invalid Params lastupdate is too high:[1513122315]"}

Zn4rK commented 7 years ago

Did you manage to sort this out? Are we adding the lastupdate param to the request?