Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

query data in sdk-oauth-master example...

ANSWERED

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 

"summary":
data.summary.totalMinutesAsleep

how would i query the variables within data[] or shortData[]?

thank you for answering :

 

that is what i can do :

query sleep log.jpg

 and i would like to store variables from sleep :

 

sleepDataIwant.jpg

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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.

View best answer in original post

Best Answer
4 REPLIES 4

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.

Best Answer

@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 .

QueryData.jpg

 

Best Answer
0 Votes

 

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);

Best Answer
0 Votes

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.

Best Answer
0 Votes