I am trying to use the get activity logs list endpoint:
https://api.fitbit.com/1/user/492W6K/activities/list.json
but I am getting the error:
{"errors":[{"errorType":"not_found","fieldName":"n/a","message":"The API you are requesting could not be found."}],"success":false}
Is this endpoint down for some reason?
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 John,
Here is the PHP code used to make the request:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.fitbit.com/1/user/$userid/activities/list.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'beforeDate=2020-02-04&sort=desc&limit=5&offset=0');
$headers = array();
$headers[] = "Authorization: Bearer $access_token";
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:'.curl_error($ch);
}
curl_close($ch);
Here is the curl request I tried:
curl -XPOST -H 'Authorization: Bearer TOKEN' -H 'Content-Type: application/x-www-form-urlencoded' -d 'beforeDate=2020-02-04&sort=desc&limit=5&offset=0' 'https://api.fitbit.com/1/user/-/activities/list.json'
Both of these resulted in the same error.
Best AnswerI think I figured it out, the parameters should have been in the URL. My bad, thanks for the help!
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 @SunsetRunner,
Your solution is correct and I'm glad you were able to resolve the issue.
Please let me know if you have any other questions.
Best Answer