API Request - Error: id 239 not found

Hello,

I use a small script to show the nb_visits on a webpage. My Code worked perfectly till the Update to 2.1.0.
On my first search I found a hint, that the request calls changed. No matter, easy to adjust.
But now I always get this message back, instead of the visitors:

This report has been reprocessed since your last click. To see this error less often, please increase the timeout value in seconds in Settings > General Settings. (error: id 239 not found).

I changed the Timout Value to 60s, 180s and now it’s on 1800s. it is too much, I have not that much visitors (~1k / month).
The result is still the same error message.

Not sure if you need the code, it is stupid api tutorial copy:

[i]Piwik\FrontController::getInstance()->init();

$request = new Piwik\API\Request(‘
method=VisitsSummary.get
&idSite=2
&period=range
&date=’.$start.’,’.$today.’
&format=PHP&serialize=0
&token_auth=’.$token.’
’);
$result = $request->process();
echo $result[‘nb_visits’];
[/i]

Hope you can help. I found the bugfix for that on github but that is still fixed in the (latest) update.

Thank you very much,

sto

please try latest 2.1.1-b6 which we just released!

tried it. the same problem. other idea? thank you!

Can you post the full code you used, I will try to replicate.

sure, hope it helps:


<?php 
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);

require_once "index.php";
require_once "core/API/Request.php";

Piwik\FrontController::getInstance()->init();

$token = 'mytoken'; // mein API Token.
$start = '2008-01-11; // use the earliest date in your database
$today = date('Y-m-d');

$request = new Piwik\API\Request('
			method=VisitsSummary.get
			&idSite=2
			&period=range
			&date='.$start.','.$today.'			
			&format=PHP&serialize=0
			&token_auth='.$token.'
');

$result = $request->process();


$total = 0;
$total = $result['nb_visits'];

$totalLength = 6;
if(strlen($total)<$totalLength) {
 for($i=0;$i<$totalLength-1;$i++) 
   $total = "0".$total;
}

echo "Visitors: $total";
?>

thank you very much!

I just tried and it works for me . I updated the doc at: Querying the Reporting API: Integrate - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3

and added the module=API in the Request constructor. Does it work with this new line?

hey, sorry for the late response. adding this line makes the same error:

This report has been reprocessed since your last click. To see this error less often, please increase the timeout value in seconds in Settings > General Settings. (error: id 239 not found).

not sure if it is the right folder but my script is in piwik root (so i changed a few lines to make the script run) if you compare my file with the api in the doc. i absolutely can’t resolve my error…

thanks for help