12-06-2020 12:42
12-06-2020 12:42
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.
12-09-2020 13:09
12-09-2020 13:09
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
12-07-2020 14:03
12-07-2020 14:03
Hello Anyone ?
Regards,
Shyam.
12-08-2020 16:40
12-08-2020 16:40
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
12-09-2020 13:09
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
12-09-2020 14:53
12-09-2020 14:53
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.