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

Heart rate Web API

ANSWERED

Hello, I am creating an app that will require access to the heart rate value from the Web API. How do i get the same like this

{
        "activities-heart": [
            {
                "customHeartRateZones": [],
                "dateTime": "today",
                "heartRateZones": [
                    {
                        "caloriesOut": 2.3246,
                        "max": 94,
                        "min": 30,
                        "minutes": 2,
                        "name": "Out of Range"
                    },
                    {
                        "caloriesOut": 0,
                        "max": 132,
                        "min": 94,
                        "minutes": 0,
                        "name": "Fat Burn"
                    },
                    {
                        "caloriesOut": 0,
                        "max": 160,
                        "min": 132,
                        "minutes": 0,
                        "name": "Cardio"
                    },
                    {
                        "caloriesOut": 0,
                        "max": 220,
                        "min": 160,
                        "minutes": 0,
                        "name": "Peak"
                    }
                ],
                "value": "64.2"
            }
        ]
      }

because i only get this now

{
    "activities-heart": [
        {
            "dateTime": "2019-06-19",
            "value": {
                "customHeartRateZones": [],
                "heartRateZones": [
                    {
                        "max": 95,
                        "min": 30,
                        "name": "Out of Range"
                    },
                    {
                        "max": 133,
                        "min": 95,
                        "name": "Fat Burn"
                    },
                    {
                        "max": 162,
                        "min": 133,
                        "name": "Cardio"
                    },
                    {
                        "max": 220,
                        "min": 162,
                        "name": "Peak"
                    }
                ]
            }
        }
    ]
}

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Hi @Gorry 

 

I'm able to get the "value" data back when executing the Heart Rate Intraday endpoint in Web API Explorer.   Would you please try the same and let me know the results?  The link is https://dev.fitbit.com/build/reference/web-api/explore.

 

You cannot query heart rate intraday data for greater than a 24 hour period.  You can query Heart Rate Time Series for more than 24 hours.  

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

View best answer in original post

Best Answer
0 Votes
9 REPLIES 9

Hi @Gorry 

 

Would you please post which endpoint you are executing?   I'm not familiar with the element name "value" in the desired response you posted.  I think it should restingHeartRate, but want to confirm.

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

this one

<a href="https://api.fitbit.com/1/user/-/activities/heart/date/today/1d/1sec/time/00:00/00:01.json" target="_blank">https://api.fitbit.com/1/user/-/activities/heart/date/today/1d/1sec/time/00:00/00:01.json</a>

and also is it possible to get data from more then 1 day?

Cause when i try to use start date and end date or change 1d to 7d i got this

 

{
    "errors": [
        {
            "errorType": "request",
            "fieldName": "n/a",
            "message": "Time range should not be bigger then 24 hours."
        }
    ]
}
Best Answer
0 Votes

Hi @Gorry 

 

I'm able to get the "value" data back when executing the Heart Rate Intraday endpoint in Web API Explorer.   Would you please try the same and let me know the results?  The link is https://dev.fitbit.com/build/reference/web-api/explore.

 

You cannot query heart rate intraday data for greater than a 24 hour period.  You can query Heart Rate Time Series for more than 24 hours.  

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

Hi, thanks for the answer that you replied, and i already got the value i wanted.

But, there's another concern about message : "Too Many Request" when i try to call Fitbit API. And i already read about 150 requests per user per hour.

My question is, context "user" in this scenario is client user or fitbit user ?

Thank you

Best Answer
0 Votes

By "user", we mean Fitbit User ID.  

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

Hello, Good Morning.

Today, i want to ask a question about if it is possible to web api to get average heart rate per day. without requesting intraday permission? maybe be there's an API to get the value


thanks

Best Answer
0 Votes

Hi @Gorry,

 

Unfortunately, we don't have an endpoint that provides average heart rate per day. However, the GET Activity Logs List endpoint can provide you with averageHeartRate data for logged activities. See below for example:

Example Response
{
    "activities": [{
        "activeDuration": 1734000,
        "activityLevel": [{
            "minutes": 4,
            "name": "sedentary"
        }, {
            "minutes": 14,
            "name": "lightly"
        }, {
            "minutes": 4,
            "name": "fairly"
        }, {
            "minutes": 6,
            "name": "very"
        }],
        "activityName": "FitStar: Personal Trainer",
        "activityTypeId": 17589491,
        "averageHeartRate": 94,
        "calories": 136,
        "caloriesLink": "https://api.fitbit.com/1/user/-/activities/calories/date/2016-03-29/2016-03-29/1min/time/8:45/9:13.json",
        "distance": 1.071811,
        "distanceUnit": "Kilometer",
        "duration": 1734000,
        "heartRateLink": "https://api.fitbit.com/1/user/-/activities/heart/date/2016-03-29/2016-03-29/1sec/time/08:45:00/09:13:54.json",
        "heartRateZones": [{
            "max": 94,
            "min": 30,
            "minutes": 16,
            "name": "Out of Range"
        },

I hope this helps. Let me know if you have any other questions!

 

 

Best Answer
0 Votes

Hi @JohnFitbit Is there any API we can use to get heart rate count records per day same as steps

Best Answer
0 Votes

Hi @Dhivakhar 

 

The endpoints available to get Heart Rate data are the time series, https://dev.fitbit.com/build/reference/web-api/heartrate-timeseries/, and the intraday, https://dev.fitbit.com/build/reference/web-api/intraday/

 

Gordon

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