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

retrieving daily totals over a time range

Hello,

 

Can you please tell me what is the best way to get total daily: sleep, exercise, and calories consumed over a range of dates via the fitbit API.

 

So far, I see the time series API sends data bewteen two dates, but they are not available for daily totals.

https://api.fitbit.com/1/user/-/activities/minutesVeryActive/date/2014-12-14/2014-12-15.json

 

Also, there are apis to get daily totals, but they work only one day at a time.

https://api.fitbit.com/1/user/-/activities/date/2014-12-14.json

https://api.fitbit.com/1/user/-/foods/log/date/2014-12-14.json

https://api.fitbit.com/1/user/-/sleep/date/2014-12-14.json

 

Do you have a way of retrieving daily total data between two dates ?

 

Thanks

 

John

Best Answer
4 REPLIES 4

anybody please 🙂

Best Answer
0 Votes

Hello,

So the time series by default will return you daily totals between the dates you specify with one day precision, right?

So /1/user/-/activities/steps/date/2014-08-18/2014-09-18.json request will return you steps totals for period of one month.

Isn't it what you were asking for?

 

There is no single endpoint that will return all different data types at once, so you'll need to make one request per data type: steps, sleep weight and etc.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

Hello Ivan,

 

Thanks in advance for your help.

 

The issue is related to total activity duration per day.  

 

A - It seems that there are only endpoints that return part of the activity duration, but not a total.  

activities/minutesLightlyActive
activities/minutesFairlyActive
activities/minutesVeryActive

 

B - On the other hand, the /activities/date endpoint that returns actvity data for a single day does provide the total activity duration for that day -- but requires making an api call for each day needed.

 

Are these the only two choices we have:

1) call each activity time series APIs (A above) and calculate total activity duration for each day

OR

2) call the activities api (B above) for each day needed and pull the total duration value for each day.

 

Thanks,

 

John

 

Best Answer

Yep, you're right those are the only two options you have right now.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes