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

Heart Rate API changed in the past week?

I was exploring the API capabilities last week and liked some of the Heart Rate API's capabilities, but it seems that what I'm getting out of the API today is not what I was getting last week, and is not what's shown in the current documentation.  https://dev.fitbit.com/build/reference/web-api/heart-rate/

 

Specifically, the resource URL

https://api.fitbit.com/1/user/[user-id]/activities/heart/date/[base-date]/[end-date].json

does not return 'activities-heart'.  It only outputs 'categories' which contains a lot of very specific activities that I don't care to track (literally, 'XBOX Sports - Baseball' and 'XBOX Sports - Darts' are in here).  

What I care to track is how many minutes I spend in each heart zone, which was provided by the 'activities-heart' output that I was looking at last week (and shown in the documentation).  Is this a temporary issue or a permanent change?

 

Edit/Update: I found that the heart rate zones are accessible still if using this query format:

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

 

But that's inefficient for collecting a lot of historical data.  I know last week I was able to query a range of dates and get that information--I had my code set up to do exactly that and it worked fine until this morning.

Best Answer
0 Votes
6 REPLIES 6

Hi @Mathman85 

 

Would you please send me the exact URL you're executing for retrieve the heart rate zones over a date range?   I think you might have a typo.

 

Gordon

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

The exact URL was:

"https://api.fitbit.com/1/user/-/activities/heart/date/2019-04-19/2019-04-26.json"

 

However, it seems to be back to its expected behavior.  I had to re-authorize the app a couple days ago... seems like the API is constantly being changed.  Which would also explain why my IFTTT applets kept failing the past few months (which is why I regressed to doing it manually).

Best Answer
0 Votes

Thanks for the update.   Typically, we shouldn't be changing the response from the APIs.  If you have a typo in the URL, then you would received unexpected behavior.  

 

Sounds like its working for you now.  Let us know if you have any further questions.

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

The API used to return the minutes spent in each heart rate zone.  Now it just returns the range of each zone as below.  

array (
  'customHeartRateZones' => 
  array (
  ),
  'heartRateZones' => 
  array (
    0 => 
    array (
      'max' => 88,
      'min' => 30,
      'name' => 'Out of Range',
    ),
    1 => 
    array (
      'max' => 123,
      'min' => 88,
      'name' => 'Fat Burn',
    ),
    2 => 
    array (
      'max' => 150,
      'min' => 123,
      'name' => 'Cardio',
    ),
    3 => 
    array (
      'max' => 220,
      'min' => 150,
      'name' => 'Peak',
    ),
  ),
)

 

In the Fitbit app, it still says how many minutes were in Peak, Cardio, and Fat Burn.  

 

I recently changed the setting in my Fitbit app back to just use the default heart rate zones instead of Custom Zones.  Do you think that has anything to do with it?

 

What should I do?  Thanks!  

Best Answer
0 Votes

HI @mikepsinn 

 

I wouldn't expect requesting the default heart rate zones to stop displaying minutes the user was in each heart rate zone.   I would expect if heart rate data was not recorded, then the minutes would not appear.   Would you please private message me your client ID and the Fitbit user id in question?   I'll investigate it from my end.

 

Gordon

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

Hi, @Gordon-C !  It seems to have resolved itself, so I guess it was a temporary issue with the API. Thanks for your help!

Best Answer
0 Votes