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

Heart Rate Intraday Time Series - Date Parameter Ignored, API call only retrieve today's data, Why?

ANSWERED

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.

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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.

Peter McLennan
Gondwana Software

View best answer in original post

Best Answer
4 REPLIES 4

@BillyBobJoe The endpoints seem to be working as they should, and returns the correct data: Fitbit Explorer

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

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.

Peter McLennan
Gondwana Software
Best Answer

I was thinking the same thing, thanks @Gondwana Robot Happy

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

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. 

Best Answer