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.
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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
Best AnswerSomebody 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.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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
Best AnswerThanks 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.
Best Answer