btroia / basis-data-export Goto Github PK
View Code? Open in Web Editor NEWUtility that exports and saves your Basis B1 or Peak device's uploaded sensor data.
License: MIT License
Utility that exports and saves your Basis B1 or Peak device's uploaded sensor data.
License: MIT License
It appears that the API may have changed. I am now seeing a v2 under networks and rather than a static user ID, it appears that a variable "me" is being used.
I'm not sure as I never saw how this previously looked, but I'm unable to find the original XHR that is referred to in the documentation.
I was able to find an ID string inside:
https://app.mybasis.com/api/v2/users/me/days/2014-02-14/activities
Hello!
How do you export data from multiple days, e.g. 2015-06-23 to 2015-06-27 ?
Thank you!
Hey,
I really love this tool, but was welcomed with this message when I ran 'php basisdataexport.php' running the latest version of OS X 10.9 Mavericks.
Parse error: parse error, expecting `":: (T_PAAMAYIM_NEKUDOTAYIM)"' in /Users/angelceballos/Documents/Development/basis-export-tool/basisdataexport.php on line 93
Thanks for this great work!
After getting the certs in place, I was able to run the scripts and download the data successfully. However, my timestamp column is blank. Did anyone else notice this too?
Doesn't capture the Advanced Sleep Analysis data... i.e
http://www.mybasis.com/wp-content/uploads/2014/01/Basis_Web_Sleep_Dashboard.png
But otherwise still works.
Interactive mode works fine, but when I use method 2 with the same credentials and date, I receive the following error:
Caught exception: ERROR: Unable to login! Check your username and password.
Caught exception: ERROR: Unable to login! Check your username and password.
Caught exception: ERROR: Unable to login! Check your username and password.
I'm using the following command:
php basisdataexport.php [email protected] -p*********** -d2015-03-01 -fjson
Hi,
First off, thanks for doing this! Much appreciated. I hope I can contribute something.
I downloaded this yesterday and had an error with the digital certificate where it would give me an ERROR: cURL error - SSL certificate problem: self signed certificate in certificate chain.
I fixed that by downloading CA certs to check against and adding a few lines to the CURL_SETOPT_ARRAY starting on line 68 in BasisExport.class.php
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CAINFO => 'CABundle.crt',
Then, I didn't get the error. However, instead of downloading data, I just get the header row in CSV, HTML, With JSON I get ERROR: could not save data to file and a 0KB data file. Any idea what is going on?
-etavares
I've uploaded the files to my webserver since I don't have a localhost running on this machine and am not well-versed in terminal usage. When I go to
http://www.mayodev.com/Basis/basisdataexport.php?date=2014-05-[01-31]
I get the following error:
Caught exception: ERROR: Unable to login! Check your username and password.
I have it configured to ask for username and password each time, but it goes straight here without asking. I also tried it with the username and password hard coded into the php file, but got the same result.
As a note, I did have to add the following line to the class file to avoid an SSL error (see below):
CURLOPT_SSL_VERIFYPEER => false,
No idea if that is part of the problem or not.
My Basis is the Carbon Steel edition
Chrome Browser (latest)
Any help is appreciated!
Caught exception: ERROR: cURL error - SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Heey,
Thank you for creating this tool. I am trying to download my data but this errors keeps popping up:
Warning: preg_match() expects parameter 2 to be string, resource given in C:\xampp\htdocs\xampp\BasisExport.class.php on line 88
Caught exception: ERROR: Unable to login! Check your username and password.
I did check my username and password and they are correct. It seems the $result parameter is not a string? Is there anything I can do solve this problem?
Thanks,
Jorrit
Thanks for writing this code!
I have successfully used this script a few months ago. I'm running it again now, and all the exported data files are empty; the html and csv files are blank, and the json file just says:
{"error_description": ["start", "end"], "description": ["start", "end"], "error": "missing_param"}
I double-checked everything, and I am using a valid login, and there is data on the Basis website for the dates I'm trying. Could it be that Basis updated the website and this no longer works? Or can you give me any ideas on how to debug this?
Thanks!
This is fantastic. Since the raw data is pretty much the main thing I'm looking for in a wearable, I might buy the Basis B1 because of this script. My only question is whether you think it will be reasonable for someone like me (who knows very little about programming) to execute it. It looks like I can either copy/paste your code into a Linux client on a virtual machine or put it somewhere my browser can access (which I assume includes somewhere locally) and do it through that route. Does that sound right? If so, I think I can handle that. Is there anything else I should know?
Thanks!!
Around 1/8 or so, the basis website seems to require some sort of authentication.
The $basis_userid seems the same when fished out using Chrome's inspect element, but the php script can no longer pull, it gets a 401 access denied.
/opt/local/bin/lynx --dump 'http://127.0.0.1/~raydawg/basis-data-export/basisdataexport.php'
Warning:
file_get_contents(https://app.mybasis.com/api/v1/chart/52a659b775ec5351
23c68041.json?summary=true&interval=60&units=s&start_date=2014-01-12&st
art_offset=0&end_offset=0&heartrate=true&steps=true&calories=true&gsr=t
rue&skin_temp=true&air_temp=true&bodystates=true)
[[1]function.file-get-contents]: failed to open stream: HTTP request
failed! HTTP/1.1 401 Unauthorized in
/Users/raydawg/Sites/basis-data-export/basisdataexport.php on
line 74
...
74 if(!$basisdata = file_get_contents($dataurl)) {
75 if ($debug) {
76 echo 'Error retrieving data: ' . $dataurl;
77 }
78 } else {
I also had to add these since the PHP included in Mac OS X was complaining about the time zone and memory limit, though they're unrelated:
17 ini_set('memory_limit', '-1'); // -1 here implies no limit, you can even set it to a bigger number like '192M' for 192Mb space.
18 date_default_timezone_set ('America/New_York');
19
20
21 $basis_userid = '52xxxxxxxxxxxxxxxxxxxxxx';
(actual ID replaced by x's to preserve privacy)
#!/bin/sh
#
now=`date +"%Y-%m-%d" -d $1`
end=`date +"%Y-%m-%d" -d $2`
while [ "$now" != "$end" ] ;
do
echo "Downloading: "$now
php basisdataexport.php -u[username] -p[password] -d$now -f[format]
now=`date +"%Y-%m-%d" -d "$now + 1 day"`;
done
Just a suggestion, that way it is easy to export range of dates by doing
./test.sh 2014-10-07 2014-10-09
:)
Any chance that you'll be able to implement the sleep tracking data to download that information?
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.