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

Intra-Day Activity Time Series for Date Range

Hi,

 

I'm trying to fetch users' intra-day time series data for a date range with a single request/response. I can get it to work if I'm fetching for a single day:

GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/1d/[detail-level].json

 

The API documentation provides this request example, which implies that fetching intra-day time series data for a date range should be possible for a user:

GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/[end-date]/[detail-level].json

 

This is not the case for me as that request returns an entirely different response. Thanks in advance!

Best Answer
6 REPLIES 6

I would like to do this one as well but your post posted more than year ago does not promise good...

 

Any developer have any help on this matter?

Best Answer
0 Votes

Queries for Intraday are restricted to a 24 hour period.  The date argument only allows a single date or the word "today".   

 

The Time Series endpoints do allow querying data for more than 24 hours.  The endpoints include start date and end date arguments, or the period of 1d, 7d, 30d, 1w, 1m, 3m, 6m or 1y.

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

I know this is an old post, but.

Based on the documentation there is indeed an endpoint that suggests that intraday data can be retrieved for a date range: https://dev.fitbit.com/build/reference/web-api/heart-rate/#get-heart-rate-intraday-time-series

GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/[end-date]/[detail-level].json


That endpoint still doesn't work. Someone should update the documentation if the endpoints are not supported.

Best Answer
0 Votes

Hi @Lorena772,

 

Welcome to the forums!

 

I can see where the confusion is. Looking at the documentation, these are the Heart Rate Intraday endpoints that we support:

GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/[end-date]/[detail-level].json
GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/[end-date]/[detail-level]/time/[start-time]/[end-time].json
GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/1d/[detail-level].json`
GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/1d/[detail-level]/time/[start-time]/[end-time].json

 

There are two sets of endpoints that provide the same data; the bottom 2 implies that only 24hrs of data can be returned while the top 2 appears that you can have a date range greater than 24 hrs. I assure you, this is not the case.

 

  • The top 2 endpoints only support 24 hours assuming that the default start time and end time is 00:00 - 00:00.
  • The bottom 2 endpoints are intended to cover a period of 24 hours if the window overlaps 2 days. For example, "date/2020-08-16/2020-08-17/1min/time/15:00/12:00.json"
    • Start time: 2020-08-16 at 15:00pm
    • End time: 2020-08-17 at 12:00pm

You are correct that the documentation can be clearer for these situations. I'll file a ticket to see how we can improve clarifying the usage of the endpoints to avoid further confusion.

 

I hope this helps clarify. Let me know if you have any additional questions in the meantime.

 

Best Answer

Hi @JohnFitbit 

Thanks for the clarification. That makes far more sense now 👍

Best Answer
0 Votes

Hi @JohnFitbit ,

 

I am trying to fetch the Intra Heart rate for the whole year. As the Intra HR is returned if the span is for 1 day, it is not possible to use the 1y range. Another solution is to make 365 API calls. However, this will hit the rate limit range of 150. So, I would like to ask if there is an elegant way to solve this?

 

Best Answer
0 Votes