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

Unexpected Response Data When Getting Steps With API

I having difficulties getting steps data when sending a GET request to a URL with the following format:

"https://api.fitbit.com/1/user/-/activities/tracker/steps/date/" + basedate + "/"+enddate+".json"

 

When "basedate" is "today" and "enddate" is before 2015-10~(haven't tested the exact date), I receive a response that looks like

{'categories': [{'activities': [{'accessLevel': 'PUBLIC', 'activityLevels': [{'id': 3016, 'maxSpeedMPH': -1, 'mets': 8.5, 'minSpeedMPH': -1, 'name': '6 - 8 inch step'}.....}

 

instead of the expected steps info as described in the documentation. Has anyone run into the same issue or know what's going on? Thank you.

Best Answer
0 Votes
1 REPLY 1

Hi @dogedoge.  The endpoint is expecting to receive the full date (yyyy-MM-dd) for the end-date value.  If you don't provide the day (2015-09), you'll get a response like

 

{
  "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"
        },

when including the day (2015-09-10), you'll get the step count

{
  "activities-tracker-steps": [
    {
      "dateTime": "2015-09-10",
      "value": "7592"
    },
    {
      "dateTime": "2015-09-11",
      "value": "3707"
    },
    {
      "dateTime": "2015-09-12",
      "value": "11044"
    },
    {
      "dateTime": "2015-09-13",
      "value": "24012"
    }, 

 

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