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

Fetch latest submitted activity logs

Hi! I am developing an app and I am using your web api development. I have some issues with fetching activity logs. I cannot rely on notification from your server. I want to fetch all new data but I cannot fetch information for more than 7d in one request(to many data). If I would be offline for 10 days, my app would not fetch logs for first three days, because I fetch max for 7 days as I mentioned.

 

Is there any ways to fetch only recent logs? I need to fetch only last logged activities. The date of activity is not important.

I am looking forward for your reply.

Thx in advance

Best Answer
0 Votes
7 REPLIES 7

Hi @Dzzzen 

 

Thank you for reaching out to us on the forums.  I should be able to give you some suggestions for fetching activity data.   Before I do, I need to get a better understanding of which endpoints you're currently using and the challenges you're facing.   Would you please answer the following questions for me?

 

  1. What type of activity data are you trying to retrieve (i.e. recorded activities, daily step data, etc)?  
  2. What's the reason for not being able to rely on the Subscription API / webhook notifications?
  3. Please provide the exact syntax of the endpoint you're executing that limits you to 7 days of data in one request? 
  4. Is the 7 day limitation due to an error from Fitbit or your servers cannot handle more data than 7 days?

Best regards,

Gordon

 

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

Hello Gordon

1. I try to retrieve recorded activities

2. From your documentation: "The Subscriptions API does not attempt to send a notification more than once. Many factors can contribute to a subscription notification being missed: Fitbit API outages, general connectivity across the internet, your application being unavailable when Fitbit attempts to send the notification, or your application not responding within three seconds to a notification request."

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

in my case date = currentDate - 7d

 

4. My server cannot handle more than 7 days. I can try to make smth with it. Would smth change if I would handle more than 7d?

 

I am looking for smth like fetching data ordered by update date.

 

Regards

Best Answer
0 Votes

Hi @Dzzzen 

 

Thank you for the additional information.  The Get Daily Activities Summary endpoint that you're executing will only give you 1 days worth of activity data and does not contain all of the recorded activities.  It does not support a date range.  Since you're only interested in the recorded activities, my recommendation is to use the Get Activity Log List endpoint, https://dev.fitbit.com/build/reference/web-api/activity/#get-activity-logs-list.  

 

The Get Activity Log List endpoint returns a complete list of only the recorded activities.  The daily step count, calories burned, etc will not be returned.   And, you can specify a date range.  Since you're only returning the recorded activities, you'll be able to fetch more data over a longer period of time.

 

The types of recorded activities returned are manually recorded through the Fitbit app, the Fitbit tracker, auto_detected through Fitbit's SmartTrack technology, and 3rd party recorded activities (i.e. Strava).  The source of the activity will be displayed in the json.

 

Gordon

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

Also, if you only want the recent logs, your application would need to keep track of the last date you fetched, and fetch from that point to the current date.   

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

Thanks for provided info about endpoints. My bad, I mismatched it.

 

If my device was offline for several days (e.g. 5 days) and last fetching in my app was 1d ago, I would fetch activities for previous day and current day and  I think some activities from device what was offline for 5d would be lost.

Is it possible?

 
Best Answer
0 Votes

If you use the Subscription API, the webhook notification will contain the date where the updated data occurs.  So, you can use that as your fetch start date.

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

I mentioned why I cannot use it. So ok, I got it.

Best Answer
0 Votes