I am trying to retrieve user's Intraday heart rate data. I have already requested and been granted access by Fitbit. My problem is no matter what I specify as the date, Fitbit API response only contains today's data. I have tried two versions of the API call listed on this page(https://dev.fitbit.com/docs/heart-rate/#get-heart-rate-intraday-time-series)
https://api.fitbit.com/1/user/-/activities/heart/date/2017-06-01/1d/1min.json
https://api.fitbit.com/1/user/-/activities/heart/date/2017-06-01/2017-06-01/1min.json
Both returns data with time stamp of current day. For example, even though I specified 2017-06-01 as the data in the API call, today is 2017-06-09, the API call would return data with time stamp 2017-06-09.
I am using this library: https://github.com/aarondcoleman/Fitbit.NET with C#. Other API calls such as sleep and intraday steps returns the correct data, but not the intraday heart series. What is wrong?
Edit: the data would change depending on the date I specify in the call, so I assume the heart rate data returned is the correct day. However the time stamp is still incorrect, how can i correct that?
Edit 2: My problem was the [activities-Heart-intraday] body only contained time value but not the date. When C# parsed it, it defaults to the current day's date. The date value is included in the [activities-Heart] json body.
Answered! Go to the Best Answer.
The problem is probably within Fitbit.NET. Since you know the date you requested, and you know the correct heart-rate data is being returned, you can probably ignore or work around the problem.
Community Moderator Alumni are previous members of the Moderation Team, which ensures conversations are friendly, factual, and on-topic. Moderators are here to answer questions, escalate bugs, and make sure your voice is heard by the larger Fitbit team. Learn more
@BillyBobJoe The endpoints seem to be working as they should, and returns the correct data: Fitbit Explorer
Best AnswerThe problem is probably within Fitbit.NET. Since you know the date you requested, and you know the correct heart-rate data is being returned, you can probably ignore or work around the problem.
Community Moderator Alumni are previous members of the Moderation Team, which ensures conversations are friendly, factual, and on-topic. Moderators are here to answer questions, escalate bugs, and make sure your voice is heard by the larger Fitbit team. Learn more
Thanks for the reply, the problem is indeed happening on the .Net side. Intraday Heart Rate Json has two components: [Activities-Heart], which contains the date and [Activities-Heart-Intraday], which contains the data value and the interval marker (i.e. 00:01:00, 00:02:00 for minute detail level). The problem is that I only serialized the [Activities-Heart-Intraday] component and parsed the minute string to dateTime. C# automatically assume the date to be current day since the string only contains the time value.