MultiSites.getAll returns wrong format under circumstances #5987

Closed
tsteur opened this Issue Aug 12, 2014 · 0 comments

Projects

None yet

1 participant

@tsteur
Member
tsteur commented Aug 12, 2014

MultiSites.getAll should always return an array of objects but sometimes it returns only a simple array (if there is only one site that matches pattern I think).

Example Url:
http://demo2.piwik.org/index.php?module=API&method=MultiSites.getAll&period=year&date=today&format=JSON&token_auth=TOKEN&pattern=piw&enhanced=1

{
nb_visits: 0,
nb_actions: 0,
label: "Example Site",
visits_evolution: "0%",
actions_evolution: "0%",
...
}

should be wrapped in [...].

I tried to workaround this issue in Piwik Mobile but it does also not return the idSite if there is only one result which makes it impossible.

This leads to an "Invalid format error" in Piwik Mobile when using the search.

@tsteur tsteur added this to the Piwik 2.5.0 milestone Aug 12, 2014
@tsteur tsteur added the Bug label Aug 12, 2014
@tsteur tsteur self-assigned this Aug 12, 2014
@tsteur tsteur added a commit that referenced this issue Aug 12, 2014
@tsteur tsteur refs #5987 I think this should make sure we always get an array if Mu…
…ltiSites.getAll finds only one site
8929743
@tsteur tsteur closed this Aug 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment