Hello,
I’ve recently began working with Piwik to integrate it into a sort of multiuser environment. I’m a little flustered because my first API attempt doesn’t seem to be working. Maybe I’m missing something though, the examples are a little brief yet and in some cases non-existent.
I first ran into the problem of not being able to find the superuser auth_token. I found it within the config/config.ini.php, and I presume it’s the token I should use in any request that would require superuser.
I built a simple script based on examples available and made use of the superuser token_auth from config.ini.php
$url = "http://foo.com";
$url .= "?module=API&method=UsersManager.getUser";
$url .= "&format=PHP";
$url .= "&token_auth=omg086ecd47c568d5ba5739d40789omg";
$url .= "&userLogin=foo";
$fetched = file_get_contents($url);
$content = unserialize($fetched);
// case error
if(!$content)
{
print("Error, content fetched = ".$fetched);
}
foreach($content as $row)
{
var_dump($row);
}
However, when run the script simply reports:
string(5) "error"
string(67) "You can't access this resource as it requires a 'superuser' access."
Any thoughts? Am I using an incorrect token_auth? Thanks in advance.