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

Activity Summary based on date range

Hey,

       Am able to fetch daily activity summary using this url -"https://api.fitbit.com/1.2/user/-/activities/date/2019-03-22.json"..

But I need to fetch data of activity summary between two dates - something like this "https://api.fitbit.com/1.2/user/-/activities/date/2019-03-22/2019-03-25.json" which results in error..

 

1. Will I be able to fetch activity summary based on date range values.

2. If not , is there any alternative solution ??

 

Note: I don't wish to fetch activity summary which includes heart rate,steps, floors something like this

 "https://api.fitbit.com/1.2/user/-/activities/floors/date/2019-03-22/2019-03-25.json" individually as i need to track multiple resource path options.

 

Hoping for your support.

Regards,

Ananthan

Best Answer
7 REPLIES 7

Hi @ananthanp,

 

First, version 1.2 of the Activity endpoints is not supported.  You need to use version 1 as documented in the Web API documentation, https://dev.fitbit.com/build/reference/web-api/activity/.

 

Unfortunately, there is not a way to get the daily activity summary information for a date range.  If you don't want to use the time series endpoints, the Get Activity Log List endpoint, https://dev.fitbit.com/build/reference/web-api/activity/#get-activity-logs-list, would probably be the closest solution for you.  You cannot specify a date range, but you could specify a begin date or end date with the number of entries to retrieve.  This endpoint will only return information for recorded activities.

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Hi @GordonFitbit,

   Thank you for the reply..  But given a start date and end date, i would like to have total number of steps,floors similar to daily activity summary.. We need this for analysis purpose..  I don't need  date based summary like this

2019-03-01 - summary,

2019-03-02 - summary  instead i would be needing collective total number of steps in a month..

 

Hoping for your reply.

Thank you,

Ananthan

 

Best Answer
0 Votes

Hi @ananthanp,

 

I can submit an enhancement request for you to create this type of output.   Enhancement requests are reviewed by the Product Management team, and I don't have a guarantee it will be accepted.   When I get more information on your request, I'll reply to this thread.

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Hi @GordonFitbit 

Perhaps this will help you with the enhancement request.

I also need to try and get a list of activities within a date range. For example if a user does 3 activities on 5th Jan. I want to be able to query the 5th of Jan alone and get all the activities (with decent data) for that day.

---------------------------------------------------------------------------------------------------------------------------------------

What I've tried so far:

This endpoint: 

Get Daily Activity Summary

GET https://api.fitbit.com/1/user/[user-id]/activities/date/[date].json

would allow me to get that data but it only includes activity manually logged.

I tried this endpoint:

Activity Time Series

GET /1/user/[user-id]/[resource-path]/date/[date]/[period].json
GET /1/user/[user-id]/[resource-path]/date/[base-date]/[end-date].json

But the data returned is not what I need, it comes back with one single granular value.

The closest I have got to is this endpoint:

Get Activity Logs List

GET https://api.fitbit.com/1/user/-/activities/list.js

This allows me to get a collection of activities but it only allows me do this from a certain date or before a certain. This date range is too vast. At scale it will return far too much data to process.

--------------------------------------------------------------------------------------------------------------------------------
Possible solutions:

Get Daily Activity Summary
This endpoint should also return activities which are not manually logged (could take in a `boolean` parameter to achieve this)

Activity Time Series
This endpoint supports a date range but the resource path options return very specific data:

activities/calories
activities/caloriesBMR
activities/steps
activities/distance
activities/floors
activities/elevation
activities/minutesSedentary
activities/minutesLightlyActive
activities/minutesFairlyActive
activities/minutesVeryActive
activities/activityCalories

add a new resource path `activities/activitySummary` which returns more data relating to the activity.

Get Activity Logs List
allow this endpoint to support a date range.

Perhaps you could pass this on to the devs, maybe one of these could be implemented quite easily.

Thanks,
Sami



Best Answer
0 Votes

Hi @samiggapps,

 

Thanks for the suggestion!

 

I recommend posting this in our Feature Suggestions page so that it may be tracked by our team. Be sure to use the "Web API" label so that the correct team can review and track interest for your suggestion.

 

When it tracks enough interest from other similar-minded users, your suggestion may be considered.

 

I hope this helps!

Best Answer
0 Votes

This feature has now been made into a feature suggestion.

If you want to see this functionality added please see https://community.fitbit.com/t5/Feature-Suggestions/Getting-a-list-of-activities-within-a-date-range... where you can add comments or up-vote.

Cheers,
Sami

Best Answer

Great news!

This feature has now been implemented and released! 

I was notified in this feature suggestion thread.

https://community.fitbit.com/t5/Feature-Suggestions/Getting-a-list-of-activities-within-a-date-range...

Hope it helps some other devs!

Best Answer
0 Votes