12-06-2020 12:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-06-2020 12:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi,
Am trying to read my activity list using the Get Activities List API from python. Other API calls work fine. Below is the request object. I am not sure what am I missing here. I get a 400 bad request exception.
url https://api.fitbit.com/1/user/-/activities/list.json
kwargs {'data': {'afterDate': '2020-11-11', 'sort': 'asc', 'limit': 20, 'offset': 0}, 'client_id': '<myclientid>', 'client_secret': '<mysecretkey>', 'headers': {'Accept-Language': 'en_US'}}
method GET
Regards,
Shyam.
Answered! Go to the Best Answer.
Accepted Solutions
12-09-2020 13:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



12-09-2020 13:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @Shyamshiv2k
I'm not familiar with python to confirm your syntax. Here's a curl example
curl -X GET "https://api.fitbit.com/1/user/-/activities/list.json?afterDate=2020-11-11&sort=asc&offset=0&limit=20" -H "accept: application/x-www-form-urlencoded" -H "authorization: Bearer <access token>"
Also, you should not be specifying your client ID and client secret when executing the API calls. Instead, use the access token provided when the user consents to share their data with your application.
Gordon
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

12-07-2020 14:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-07-2020 14:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello Anyone ?
Regards,
Shyam.

12-08-2020 16:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-08-2020 16:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Somebody pls help !!!!!! Even if you can point me to any example on github or something for this specific method using python it would be helpful.

12-09-2020 13:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



12-09-2020 13:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @Shyamshiv2k
I'm not familiar with python to confirm your syntax. Here's a curl example
curl -X GET "https://api.fitbit.com/1/user/-/activities/list.json?afterDate=2020-11-11&sort=asc&offset=0&limit=20" -H "accept: application/x-www-form-urlencoded" -H "authorization: Bearer <access token>"
Also, you should not be specifying your client ID and client secret when executing the API calls. Instead, use the access token provided when the user consents to share their data with your application.
Gordon
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

12-09-2020 14:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-09-2020 14:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks GordonFitbit,
I just played around with the parameters in my python code to exactly match the curl command you have given above as example and it worked. Thanks.
Main thing was the send the parameters as "params" and not as "data" to the requests.get method. Once I changed that it worked.
Regards,
Shyam.

