Issue with getUsersAccessFromSite?


I’ve recently been working with piwik’s API, and reach an issue with the UsersManager.getUsersAccessFromSite function.

I’m querying the API for siteId = 1, which has only one user. The result is :

$ curl ''

Now if I add an other user to that site, I get:

$ curl ''

Why is the output in case of only one member different that with two?
In the first case, I would have expected


If I change (in /plugins/UsersManager/API.php):

// return $return;
// into
return array($return);

and set only one user for that site, the output looks as expected:

$ curl ''

But turns on some errors in the classical piwik.

Can someone explain me if I’m wrong? I just don’t get this behavior!

Thanks in advance.

Thanks for the report that’s indeed a bug in piwik, that when 1 item is returned we simplify the output. In this case though, it shouldn’t be simplified. Can you please create a ticket at with the expected VS output and the proposed patch to fix hte issue, and link to this post, we will fix it :slight_smile: thanks for your report!

The ticket is open, I hope I set it at the right place.

Feel free ton contact me for further information.

Bug has been fixed!

Hey, incredible!
I’ll have a look on the diff.