Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling API returns error message #5673

Closed
anonymous-matomo-user opened this issue Jun 12, 2008 · 2 comments
Closed

Calling API returns error message #5673

anonymous-matomo-user opened this issue Jun 12, 2008 · 2 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Milestone

Comments

@anonymous-matomo-user
Copy link

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
Copy link
Member

mattab commented Jun 30, 2008

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-matomo-user
Copy link
Author

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

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

2 participants