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

Getting 400 response trying to get activities list

ANSWERED

I have an app (configured as Personal) that successfully authenticates and retrieves summary data, but it fails when I attempt to get my activities list. The scopes I'm authorizing are:

string[] scopes = new string[] { "activity", "heartrate", "profile", "sleep", "weight" };

The URL I'm calling is:

https://api.fitbit.com/1/user/-/activities/list.json?beforeDate=2016-11-24&sort=desc&limit=10

With the exception of the date value, this URL matches exactly to an example I found on this forum, but the response I get is 400 : Bad Request

 

Any suggestions on what I'm doing wrong?

 

Thanks,

Chris

Best Answer
1 BEST ANSWER

Accepted Solutions
Best Answer
3 REPLIES 3

Hi,

 

check DOC - https://dev.fitbit.com/docs/activity/#get-activity-logs-list offset is required parameter

Best Answer

My first attempt was with all the parameters, sorted the way they appear in the Docs. I got the 400 error so started playing with them. The Docs also state that offset is only required for now, when I saw the example I assumed that "now" had expired so tried the call without it.

 

After much trial and error I have found a call syntax that works, and am now happily parsing activity data. 

https://api.fitbit.com/1/user/-/activities/list.json?afterDate=2016-11-26&sort=asc&limit=10&offset=0

 

I really wanted to use beforeDate and sort=desc, but such is life.Hope this helps someone else down the road.

 

Chris

Best Answer
0 Votes

CuriousChris wrote:

After much trial and error I have found a call syntax that works, and am now happily parsing activity data. 

https://api.fitbit.com/1/user/-/activities/list.json?afterDate=2016-11-26&sort=asc&limit=10&offset=0

 

I really wanted to use beforeDate and sort=desc, but such is life.


@CuriousChris You can, just change the parameters:

https://api.fitbit.com/1/user/-/activities/list.json?beforeDate=today&sort=desc&limit=10&offset=0

 

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes