06-19-2018 11:04
06-19-2018 11:04
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.
06-25-2018 12:25
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
06-25-2018 12:25
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"
},
Best Answer