@anonymous-piwik-user opened this Issue on June 12th 2008

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.

@mattab commented on June 30th 2008 Owner

Have you used the token that you get when you are logged in, by going to the API section?

It loooks like you are using a token from a user who doesn't have enough permission on this website. reopen if i'm wrong.

@anonymous-piwik-user commented on June 30th 2008

I use the tocken provided when I'm logged in as administrator.

This Issue was closed on March 19th 2010
Powered by GitHub Issue Mirror