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

Issue with the Get Heart Rate Intraday Time Series API endpoint

According to the API documentation, the Get Heart Rate Intraday Time Series API endpoint is accessible under 4 acceptable URL formats:

1 - GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/[end-date]/[detail-level].json
2 - GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/[end-date]/[detail-level]/time/[start-time]/[end-time].json
3 - GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/1d/[detail-level].json`
4 - GET https://api.fitbit.com/1/user/-/activities/heart/date/[date]/1d/[detail-level]/time/[start-time]/[end-time].json

The endpoints 3 and 4 are working as expected. Below is the output from the endpoint 3, that is working properly. Some arrays were truncated for better readability:

URL: https://api.fitbit.com/1/user/-/activities/heart/date/2020-09-30/1d/1sec.json

{
    "activities-heart": [
        {
            "dateTime": "2020-09-30",
            "value": {
                "customHeartRateZones": [],
                "heartRateZones": [
                    {
                        "caloriesOut": 2076.2116,
                        "max": 118,
                        "min": 30,
                        "minutes": 1394,
                        "name": "Out of Range"
                    }
                ],
                "restingHeartRate": 71
            }
        }
    ],
    "activities-heart-intraday": {
        "dataset": [
            {
                "time": "08:02:01",
                "value": 70
            },
            {
                "time": "08:02:16",
                "value": 70
            }
        ],
        "datasetInterval": 1,
        "datasetType": "second"
    }
}

The endpoints 1 and 2 are not working as expected. I noted that the format of the end-date parameter is not documented under the Resource URLs section, I guess it has the same format as the one used in the Get Heart Rate Time Series (in the yyyy-MM-dd format).

For example, when I try the following URL: https://api.fitbit.com/1/user/-/activities/heart/date/2020-09-30/2020-10-01/1sec.json

I get the output below (I truncated the categories array for better readability). It looks like the output of this endpoint only consists of a categories field whose associated value is an array.

Instead of this, I was expecting to see an output similar to the one produced by endpoint 3, but for the specified date range (2020-09-30 to 2020-10-01)

{
    "categories": [
        {
            "activities": [
                {
                    "accessLevel": "PUBLIC",
                    "activityLevels": [
                        {
                            "id": 3016,
                            "maxSpeedMPH": -1,
                            "mets": 8.5,
                            "minSpeedMPH": -1,
                            "name": "6 - 8 inch step"
                        },
                        {
                            "id": 3017,
                            "maxSpeedMPH": -1,
                            "mets": 10,
                            "minSpeedMPH": -1,
                            "name": "10 - 12 inch step"
                        }
                    ],
                    "hasSpeed": false,
                    "id": 90004,
                    "name": "Aerobic step"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 3015,
                    "mets": 6.5,
                    "name": "Aerobic, general"
                },
                {
                    "accessLevel": "PUBLIC",
                    "activityLevels": [
                        {
                            "id": 3020,
                            "maxSpeedMPH": -1,
                            "mets": 5,
                            "minSpeedMPH": -1,
                            "name": "low impact"
                        },
                        {
                            "id": 3021,
                            "maxSpeedMPH": -1,
                            "mets": 7,
                            "minSpeedMPH": -1,
                            "name": "high impact"
                        }
                    ],
                    "hasSpeed": false,
                    "id": 90005,
                    "name": "Aerobics"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 3050,
                    "mets": 5.5,
                    "name": "Anishinaabe Jingle Dancing or other traditional American Indian dancing"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 3010,
                    "mets": 4.800000190734863,
                    "name": "Ballet"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 3040,
                    "mets": 3,
                    "name": "Ballroom, slow (e.g. waltz, foxtrot, slow dancing), samba, tango, 19th C, mambo, chacha"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 3031,
                    "mets": 5,
                    "name": "Dancing"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 3025,
                    "mets": 4.5,
                    "name": "General, Greek, Middle Eastern, hula, flamenco, belly, swing"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 56001,
                    "mets": 5.5,
                    "name": "Zumba"
                }
            ],
            "id": 0,
            "name": "Dancing"
        },
        {
            "activities": [
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4010,
                    "mets": 4,
                    "name": "Digging worms, with shovel"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4001,
                    "mets": 3,
                    "name": "Fishing"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4030,
                    "mets": 2.5,
                    "name": "Fishing from boat, sitting"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4020,
                    "mets": 4,
                    "name": "Fishing from river bank and walking"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4040,
                    "mets": 3.5,
                    "name": "Fishing from river bank, standing"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4050,
                    "mets": 6,
                    "name": "Fishing in stream, in waders"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4060,
                    "mets": 2,
                    "name": "Fishing, ice, sitting"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4100,
                    "mets": 5,
                    "name": "Hunting"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4070,
                    "mets": 2.5,
                    "name": "Hunting, bow and arrow or crossbow"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4080,
                    "mets": 6,
                    "name": "Hunting, deer, elk, large game"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4090,
                    "mets": 2.5,
                    "name": "Hunting, duck, wading"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4110,
                    "mets": 6,
                    "name": "Hunting, pheasants or grouse"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4120,
                    "mets": 5,
                    "name": "Hunting, rabbit, squirrel, prairie chick, raccoon, small game"
                },
                {
                    "accessLevel": "PUBLIC",
                    "hasSpeed": false,
                    "id": 4130,
                    "mets": 2.5,
                    "name": "Shooting"
                }
            ],
            "id": 1,
            "name": "Fishing and Hunting"
        }
    ]
}

 Am I doing something wrong when using the endpoint number 1?

Best Answer
0 Votes
1 REPLY 1

Hi @rbsamoht 

 

That is a known problem and we already have a ticket filed to engineering to fix the problem.  I don't have a timeframe for when the fix will be available.

 

Gordon

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