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

offset not working

ANSWERED

Hi, 

I'm trying to access data with this call:

https://api.fitbit.com/1/user/-/activities/list.json?afterDate=2017-03-28&limit=10&offset=0

 

But I keep getting this response:

{"errors":[{"errorType":"validation","fieldName":"offset","message":"Offset is required"}]}

 

Am I missing something?

Thanks!

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

@jbarranis Ah I see. Add quotes around the endpoint like this:

 

curl -i -H "Authorization: Bearer <access_token>" "https://api.fitbit.com/1/user/-/activities/list.json?limit=10&sort=desc&beforeDate=2016-03-30&offset=0"

 

Andrew | Community Moderator, Fitbit

What motivates you?

View best answer in original post

Best Answer
0 Votes
4 REPLIES 4

@jbarranis That's strange because you're missing "sort", not "offset".

 

here's an example:

https://api.fitbit.com/1/user/-/activities/list.json?limit=10&sort=desc&beforeDate=2017-03-28&offset=0
Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

I wonder if it's related to how it's getting interpreted. I'm using curl to test it out and now I'm getting a different error:

 

curl -i -H "Authorization: Bearer <access_token>" https://api.fitbit.com/1/user/-/activities/list.json?limit=10&sort=desc&beforeDate=2017-03-28&offset=0

Now the error is:

{"errors":[{"errorType":"validation","fieldName":"date","message":"beforeDate or afterDate is required"}]}

Best Answer
0 Votes

@jbarranis Ah I see. Add quotes around the endpoint like this:

 

curl -i -H "Authorization: Bearer <access_token>" "https://api.fitbit.com/1/user/-/activities/list.json?limit=10&sort=desc&beforeDate=2016-03-30&offset=0"

 

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Yep, that was it! Thanks @AndrewFitbit!

Best Answer