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

intraday activities requests with UTC timezone use local time to check the start time of the range

I think I'm seeing a bug with the way you handle requests using the timezone: 'UTC" parameter.
 
It's currently June 1st, 5:41am UTC time
 
 
(your post editor won't let me use date strings for some reason)
DATE is a valid string for the date May 31st
 
But I get a 400 response status with message: "Time range start time is in future."

I did some more experimentation. It looks like the data is coming back successfully and correctly as UTC when I make other requests. But, you must have a check for the start time which incorrectly interprets it as local time, although the data comes back as UTC.

Can you confirm that this is a known problem? I'm going to have to artificially expand the range to start earlier to get around it, but it would be better not to do that and have extra data that I don't need in the response.

Thanks,

Christine
Best Answer
0 Votes
5 REPLIES 5

Btw, for posting in this forum, when I tried to use the correct YYYY-MM-DD string for May 31, 2023 in the api above, I get:

"The message body contains xxxxxxx, which is not permitted in this community. Please remove this content before sending your post."

(with the numeric date in there, of course)

Also "Preview" shows a blank page unless there are errors.

You might want to look into that too. It's a bit frustrating.

Best Answer

That forum error also blocks links to the official Fitbit dev blog, which limits my ability to help people.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Hi @agent_never 

Let me see if I understand your problem correctly.   You are trying to call the endpoint

GET https://api.fitbit.com/1/user/-/activities/steps/date/2023-05-31/2023-05-31/15min/time/23:00/23:59.j...

and you are getting the error "Time range start time is in future."  When you were trying to call the endpoint, the local time was 2023-06-01 05:41 UTC.  Is this correct?

What timezone is the user in that you're query?

Gordon

 

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

Yes the time was 2023-\06-\01 \05:41 UTC

The user was in time zone "America/New_York", so the local time was 2023-\06-\01 \01:41

Best Answer
0 Votes
It seems like using this api with the timezone "UTC" parameter is just very buggy. I've noticed an additional issue now trying to get UTC data and it occurs with the "calorie" resource only.
 
At June 12, 18:45 UTC and I tried the api that follows. The user's time zone this time is "America/Los_Angeles" so their local time is 11:45. DATE is a valid string for June 12th of this year. If I use parameter timezone: 'UTC" with this api:
 
I get data back which is UTC, however it cuts off at 11:45 instead of 18:45. (I get all zeroes after 11:45) So you must have something in your code which incorrectly uses the local time to determine how far forward in time to retrieve data for a user. This only occurs with calories as far as I see right now. Maybe this has something to do with the fact that you handle calories differently since you calculate them from other metrics. That's my assumption anyway.

So, it seems like the timezone 'UTC' parameter is not usable.
Best Answer
0 Votes