01-28-2020 07:22
01-28-2020 07:22
Hello fitbit,
I am calling below API to get date wise activities array.
API:
https://api.fitbit.com/1/user/[user-id]/activities/date/[date].json
Response:
{
"activities":[
{
"activityId":51007,
"activityParentId":90019,
"calories":230,
"description":"7mph",
"distance":2.04,
"duration":1097053,
"hasStartTime":true,
"isFavorite":true,
"logId":1154701,
"name":"Treadmill, 0% Incline",
"startTime":"00:25",
"steps":3783
}
],
"goals":{
"caloriesOut":2826,
"distance":8.05,
"floors":150,
"steps":10000
},
"summary":{
"activityCalories":230,
"caloriesBMR":1913,
"caloriesOut":2143,
"distances":[
{"activity":"tracker", "distance":1.32},
{"activity":"loggedActivities", "distance":0},
{"activity":"total","distance":1.32},
{"activity":"veryActive", "distance":0.51},
{"activity":"moderatelyActive", "distance":0.51},
{"activity":"lightlyActive", "distance":0.51},
{"activity":"sedentaryActive", "distance":0.51},
{"activity":"Treadmill, 0% Incline", "distance":3.28}
],
"elevation":48.77,
"fairlyActiveMinutes":0,
"floors":16,
"lightlyActiveMinutes":0,
"marginalCalories":200,
"sedentaryMinutes":1166,
"steps":0,
"veryActiveMinutes":0
}
}
Above is perfect that I was using.
Now I want it for one month activities so as per documentation I am calling below:
API
https://api.fitbit.com/1/user/-/activities/list.json
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.j...",
"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...",
"heartRateZones": [{
"max": 94,
"min": 30,
"minutes": 16,
"name": "Out of Range"
}],
"pagination": {
"beforeDate": "2016-03-30",
"limit": 10,
"sort": "desc"
}
}
So my question is why both responses are different I need one month activities response same as first API.
Or can you suggest me how can I get last one month activities with same response as my first API response.
Help would be appreciated.
Many Thanks.
01-28-2020 14:30
01-28-2020 14:30
Hi @goyo_bs,
Welcome to the forums!
The two endpoints you provided are very different activity endpoints. Allow me to explain.
The GET Daily Activity Summary endpoint can only provide you with summaries for a specific date and cannot be used to query a month's worth of data.
Alternatively, you can use the Get Activity Logs List endpoint to return up to 100 activities before a certain date, but this will not return daily summary totals for each date, only activity totals. This will also not guarantee that you will see month's worth of data as you are fetching by activity amount rather than a time period.
If you would like to see the GET Daily Activity Summary endpoint provide summary totals for periods larger than 1 day at a time, I recommend sharing your idea at our Feature Suggestions page to begin tracking interest for it. Our Product Teams review this board quite often and may take your idea into consideration if it shows enough interest.
I hope this helps. Please let me know if you need additional clarification.
01-28-2020 21:08
01-28-2020 21:08
Hello @JohnFitbit ,
I really appreciate for your quick reply.
So as you are saying there is no endpoint to get same response like I am getting in Get Daily Activity Summary for "activities" for one month right?
If So I will definitely write on mentioned Feature Suggestions page.
Thanks.
01-29-2020 10:58
01-29-2020 10:58
@goyo_bs That is correct. It is not possible to query a month's worth of data using the Get Daily Activity Summary endpoint.