[Piwik-trac] [Piwik] #253: Calling API returns error message
Piwik
trac at piwik.org
Thu Jun 12 11:24:52 CEST 2008
#253: Calling API returns error message
----------------------------+-----------------------------------------------
Reporter: lorenzoferrara | Type: Bug
Status: new | Priority: major
Milestone: | Component: Core
Version: | Keywords: auth_token, api
----------------------------+-----------------------------------------------
Hello,
I've created a new PHP script which calls Piwik_API_Request. I've included
the token_auth variable in the call but I keep getting:
{{{
Array ( [result] => error [message] => You can't access this resource as
it requires a 'view' access for the website id = 2. )
}}}
This is part of the code:
{{{
define('PIWIK_INCLUDE_PATH', '.');
define('ENABLE_DISPATCH', false);
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/modules/API/Request.php";
Piwik_FrontController::getInstance()->init();
$request = new Piwik_API_Request ("method=VisitsSummary.get
&idSite=$idsite
&period=year
&date=last2
&format=PHP
&serialize=0
&prettyDisplay=0
&token_auth=$token_auth");
$result = $request->process();
print_r($result);
}}}
The call doesn't produce any error if I'm logged in.
--
Ticket URL: <http://dev.piwik.org/trac/ticket/253>
Piwik <http://piwik.org>
Piwik, open source web analytics software
More information about the Piwik-trac
mailing list