06-09-2020 10:24
06-09-2020 10:24
Hi !
i m very new to FitBit, and i m now struggling to access data in webAPI sorry for that...
i m willing to query some data from sleep logs,
In the oauth project there is an example and i can print the variables within
data.summary.totalMinutesAsleep
how would i query the variables within data[] or shortData[]?
thank you for answering :
that is what i can do :
and i would like to store variables from sleep :
Answered! Go to the Best Answer.
06-09-2020 20:42 - edited 06-09-2020 20:43
06-09-2020 20:42 - edited 06-09-2020 20:43
Hello Slumberlander,
You don't need to send your data to your app to process it. It is usually easier and more efficient to do most of your processing there as the phone has considerably more power than any watch.
You may want to start in the companion app with a console.log of the data variable to see what you get.
06-09-2020 20:42 - edited 06-09-2020 20:43
06-09-2020 20:42 - edited 06-09-2020 20:43
Hello Slumberlander,
You don't need to send your data to your app to process it. It is usually easier and more efficient to do most of your processing there as the phone has considerably more power than any watch.
You may want to start in the companion app with a console.log of the data variable to see what you get.
06-10-2020 05:46
06-10-2020 05:46
@morningReign Thank you for your answer,
i understand a very little more each day : thanksfull!
so i get it : no need to send to app/index, but still : how do i reach data within {"sleep:[{"object1":value,"object2":value, etc...}]}
i can console.log ("sleep") but how shall i ask, within "sleep", for "duration" for instance?
here is a pic for clarity...
it looks like i m missing some js basic syntaxe, a little push would be apreciated though.
by advance thank you .
06-10-2020 07:48
06-10-2020 07:48
ah ok ! i did nt understand that all the variables i m interested in are stored together in index[o]...
console.log(data.sleep[0].levels.data);
06-10-2020 10:56
06-10-2020 10:56
W3 schools has a very good, very concise JavaScript tutorial at https://www.w3schools.com/js/
I highly recommend it. I review it periodically myself.