04-01-2017 09:19
04-01-2017 09:19
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!
Answered! Go to the Best Answer.
04-01-2017 12:01
04-01-2017 12:01
@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"
04-01-2017 10:00
04-01-2017 10:00
@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
04-01-2017 10:33
04-01-2017 10:33
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"}]}
04-01-2017 12:01
04-01-2017 12:01
@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"
04-01-2017 13:07
04-01-2017 13:07
Yep, that was it! Thanks @AndrewFitbit!