03-07-2020 12:21
03-07-2020 12:21
I'm trying to get activity list as shown in https://dev.fitbit.com/build/reference/web-api/explore/#/Activity/getActivitiesLogList using this code:
var userID = '123467'
var date = '2020-02-12'
var exerciseXhr = new XMLHttpRequest();
// dates need to be in YYYY-MM-DD format
exerciseXhr.open('GET', 'https://api.fitbit.com/1/user/'+ userID +'/activities/list.json?afterDate='+date+'&sort=asc&offset=0&limit=8');
exerciseXhr.setRequestHeader("Authorization", 'Bearer ' + access_token);
exerciseXhr.onload = function () {
if (exerciseXhr.status === 200) {
console.log(exerciseXhr.responseText);
}
};
exerciseXhr.send();
However, I get a 400 error. Any ideas?
03-11-2020 15:46
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.
03-11-2020 15:46
Hi @heartkiIIer,
Welcome to the forums!
So that I can investigate, can you provide me with your full HTTP request? I need to be able to see the endpoint, headers, and body of your request to make sure the formatting is correct.
Can you also provide me with the error message associated with the error code you're seeing?
Best Answer