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
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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?
Best regards,
Gordon
Best AnswerHello 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
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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.
Best AnswerThanks 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
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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.
Best Answer