zn4rk / php-withings Goto Github PK
View Code? Open in Web Editor NEWPSR-FIG Compatible Withings Body metrics Services API written in PHP.
PSR-FIG Compatible Withings Body metrics Services API written in PHP.
Hii,
I am using your lib(dev-master branch) for accessing withings API'.
To get all activities I am calling $api->getActivity()
It gives me proper result except of calories value always to zero.
Can you please check and fix.
Note:- I am using your unstable version "dev-master", because of dependency support.
Please update me soon
🥇
Hello,
if php-withings is compatible with socialite 3 (but I have no idea about this, nor I know what changed since v2), could you mark it as compatible / allow socialite 3 as dependency ("~2.0 || ~3.0"
I guess) ?
Thanks :)
Hi again,
I'm trying to get Activities now. Like steps on a specific date. The date params needs to be present, I've added it, also modified the file Api.php to add the date to the request, but it still doesn't add it to the request. It sends a request to the API properly, while forgetting to input the data parameter.
Here's the modification I made to Activity.php (otherwise I was getting thrown exceptions coz the date was missing)
public function getActivity(array $params=array()) {
if(empty($params) || !isset($params['date'])) {
throw new ApiException('Parameter "date" can\'t be empty');
}
// Activity... I don't have any withingsproducts that have
// activites so this is untested...
$activity = $this->request('v2/measure', 'getactivity');
$activity += $params; // That add the data to the request params, as it wasn't sent to the collection before
return new Collection\Activity($activity);
}
Hey again.
Was there an update of the API recently? Coz there's something I dont understand. When I follow your code, I get redirected to Withings, I log in, then get redirected to my page, not worries there.
But from Withing I receive this array:
array(3) {
["userid"]=>
string(7) "XXXXX" //normal number
["oauth_token"]=>
string(61) "49dcd9819fbfd610dee730f4d0bc32515633433e470fe6229ef3319421bd7"
["oauth_verifier"]=>
string(12) "dNesjYPowBLZ"
}
but then when I get redirected I get an error saying that the Token.php file requires another sort of array, containing access_token and secret. But I don't have that anywhere else.
Can you tell me if I'm doing something wrong, or has the API changed?
Cheers
BTW: Im using your example code.
I can't get getActivites working. It's not returning any values the same way getMeasures() is. I've tried to recreate the foreach loop used in the example.
$config is the same used for measures (example).
$api = new WithingsApi($config);
$Auser = $api->getUser();
foreach($Auser->getActivites() as $activites) {
echo $activites->getCreatedAt() . ':
';
echo 'Steps: ' . $activites->getSteps() . ' steps';
echo '<hr>';
}
After update of withings api we have problem:
`Exception 'Paxx\Withings\Exception\WbsException' with message 'Unspecified unknown error occurred'
in /vendor/paxx/withings/src/Paxx/Withings/Api.php:126`
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]"}
Hello,
I'm trying to write my chart app with laravel5, but I get an error loading this API. It complaints that the serviceProvider does not implement a package method.
I havebread online that Laravel 5 has changed its packaging,but as I'm very new to Laravel, I'm not able to fix this..
Any help would be welcome.
Getting this message:
"Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for paxx/withings dev-master -> satisfiable by paxx/withings[dev-master].
- paxx/withings dev-master requires chrisnharvey/oauth1 dev-master -> no matching package found.
Potential causes:
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems."
On chrisnharvey/oauth1 it says "Deprecated: Use league/oauth1-client." https://github.com/thephpleague/oauth1-client
Hello
for following types I always receive nothing back
5 => 'fat_free_mass',
6 => 'fat_ratio',
8 => 'fat_mass_weight',
e.g.:
$params_weight['meastype'] = "5";
$params_weight['category'] = "1";
$params_weight['limit'] = "5";
$weight = $api->getMeasures($params_weight);
leaving "meastype" empty shows me that I have some measurements.
e.g.:
$params_weight['meastype'] = "";
$params_weight['category'] = "1";
$params_weight['limit'] = "5";
$weight = $api->getMeasures($params_weight);
Cannot find the issue.
Thx,
jvc
The thing named Collection
is actually more like an entity, or a value object. Collections--especially in the Laravel sense--are like a grouping of many similar items. So the SubscriptionList profiles
parameter would be a collection; it's many profiles. Or, the array of groups
that's attached to a measure could be a collection instead of an array. But most of the things called "Collection" here are really a single class of objects with a particular set of properties, etc. which would mean they're not really a collection.
I'd be happy to write a PR, but I want to be sure that you're interested in it first; I think they should be converted to be entities (naming difference) with their properties set explicitly rather than dynamically; e.g.
<?php
class Measure extends Entity
{
/** @var Carbon **/
public $updatedtime;
/** @var MeasureGroupCollection */
public $groups;
// etcetera...
}
Problem 1
- Installation request for paxx/withings 1.0.0 -> satisfiable by paxx/withings[1.0.0].
- paxx/withings 1.0.0 requires chrisnharvey/oauth1 dev-master -> no matching package found.
Hello,
I'm trying to use this API to fetch my withings data and display it using amCharts.js (much better graphs than withings...)
But I need to reverse the results returned by the API (date is DESC and amCharts need it ASC)
I do have a properly validated MeasureCollection, and I tried those 2 functions on it :
$user->getMeasures()->reverse()
$user->getMeasures()->flatten()
Both fail with the same error message :
Warning: Invalid argument supplied for foreach() in /volume1/web/private/weight/withings/lib/src/Paxx/Withings/Collection/MeasureCollection.php on line 17
I'll find a very inneficient way to do this in anotherway in the meantime, but if you have any hint on why it does not work, that would be very appreciated.
Also, I've slightly modified the Measure class to include some metrics that were not present, such as mucle mass and hydration mass (as well as dumb functions to get the % of the total mass instead of raw kg measure for those 2). I'm new to git so I'll try to submit a PR if I can find the time.
Best regards,
toxic0berliner.
Hello. I'm looking for someone to use this library to pull in weight measurements for users of my site. Is anyone interested in working on this project?
Thank you
Hello,
can you add the new O2 functionality to the source.
54 is missing in MeasureType.php.
thx,
jvc
private $types = array(
1 => 'weight',
4 => 'height',
5 => 'fat_free_mass',
6 => 'fat_ratio',
8 => 'fat_mass_weight',
9 => 'diastolic_blood_pressure',
10 => 'systolic_blood_pressure',
11 => 'heart_pulse',
54 => 'SP02'
);
Hi,
i'd like to use your package, but the version you use for illuminate/support is on Laravel 4.0. But Laravel is now on 4.1
Could you update the dependency please?
Thanks
It'd be valuable to version this in general, but especially since the work I'm about to submit on renaming Collections ( #11) may be breaking the public API against the old work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.