Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get activity logs list error: api not found

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?

Best Answer
0 Votes
4 REPLIES 4

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.

Best Answer
0 Votes

 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 Answer
0 Votes

I think I figured it out, the parameters should have been in the URL. My bad, thanks for the help!

Best Answer
0 Votes

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.

Best Answer
0 Votes