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
Answered! Go to the Best Answer.
Hi,
check DOC - https://dev.fitbit.com/docs/activity/#get-activity-logs-list offset is required parameter
Hi,
check DOC - https://dev.fitbit.com/docs/activity/#get-activity-logs-list offset is required parameter
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
Community Moderator Alumni are previous members of the Moderation Team, which ensures conversations are friendly, factual, and on-topic. Moderators are here to answer questions, escalate bugs, and make sure your voice is heard by the larger Fitbit team. Learn more
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
Best Answer