03-11-2020 14:25
03-11-2020 14:25
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?
03-11-2020 16:17
03-11-2020 16:17
Hi @rocketslay1,
Can you provide me with your full HTTP request? I need to see the body, parameters, header, and endpoint to make sure your request was formatted correctly.
Hope to hear from you soon.
03-11-2020 17:09
03-11-2020 17:09
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.
03-11-2020 17:14
03-11-2020 17:14
I think I figured it out, the parameters should have been in the URL. My bad, thanks for the help!
03-17-2020 14:13
03-17-2020 14:13
Hi @rocketslay1,
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.