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

FitBit api error max days

Hey all you fellow devs out there! I hope someone has come across this before, so hopefully there will be a definitive answer, because fitbit surely hasn't given one.

 

I am getting this error message from time to time:

 

"The number of days between time series start and end dates cannot exceed MAX"

 

Now I know there has been one post where a person posted that he has observed it to be 1094 days, but I don't think thats the case, and it's really getting annoying. What I am doing is getting the last server sync to determine when I should pull data from. This cause the errors to be thrown a lot due to the fact some of our customers haven't synced in ages. So then I put in a clause that just checked to see if the last sync date was greater than 1090 days and setting the pull from date to be today - 1000 days, knocking out 4 of those days and it still failed with the same error. So then I just checked to see if it was greater than 500 and setting it to january 1st, 2016. Obviously much less than 1094 days. Still failed with that same error message. So then I just got annoyed and set it to Jan 1st of 2017 and I haven't had much of an issue yet.

 

So it looks as though it has a constant(probably called MAX, as determined by the response) set on their side that is a number of days you can pull and I have exceeded that number of days. Thats what I am gathering from it. Can anyone tell me what that number of days is? You would think it would be returned in the response, but no, apparently they don't want us to know. If anyone knows what the number of days is, I'd be forever grateful. 

Best Answer
3 REPLIES 3

@Taddy_Mason can you please provide the api URL that you're trying to hit?

Best Answer
0 Votes

@IoanbsuFitbit Here are the endpoints I am calling.

 

activities/tracker/distance
activities/tracker/floors
activities/tracker/steps
foods/log/water
sleep/minutesAsleep
activities/tracker/minutesFairlyActive
activities/tracker/minutesVeryActive
activities/tracker/calories

 

Of course I am passing an to and from date as well in the correct format. All of these at some point in time have returned that error from the api. Now, I am executing the calls in a loop, so all of these are passing in the same start and end date, which coincides with the last time the tracker was synced to the fitbit server plus a week or two, just in case there has been several server syncs. When I tried tweaking out the dates, some of them still threw the error, but some did not. SO clearly there are differing values, all of which are undocumented.

 

Jeff

Best Answer

Hi Jeff!

 

I'm looking into this issue, but I am not sure what's causing it. The MAX number of days should be the same for all the endpoints at 1095 (3 years).

 

For each of the endpoints, could you provide me with the full API call you're making? Preferably one that succeeded and one that failed for each one.

 

Thanks!
Pradeep

Best Answer
0 Votes