@tsteur opened this Issue on January 19th 2015 Member

Compare eg output of http://demo.piwik.org/index.php?module=API&method=API.get&idSite=7&period=day&date=yesterday&format=JSON&token_auth=anonymous

{"nb_uniq_visitors":586,"nb_visits":651,"nb_users":0,"nb_actions":1394,"max_actions":48,...}

with output of http://demo.piwik.org/index.php?module=API&method=API.get&idSite=7&period=day&date=yesterday&format=JSON&token_auth=anonymous&columns=nb_visits

{"value":651}

Expected is

{"nb_visits":651}

I wouldn't be surprised if this even causes bugs in the UI etc depending on the selected columns

@diosmosis commented on January 19th 2015 Member

Note: this is due to logic that reduces DataTable w/ one row + one column to single value (ie [{"nb_visits": 0}] turns into 0), so the column name is lost. This logic might be in core/Archive.php as opposed to the DataTable renderer.

@mattab commented on February 7th 2015 Member

it would be BC break so adding to 3.0.0 milestone in case we want to fix it then

@andyjdavis commented on May 6th 2021 Contributor
@andyjdavis commented on May 9th 2021 Contributor

Here is a possible fix for this. https://github.com/matomo-org/matomo/pull/17535

There are currently test failures as I haven't yet updated the expected values in the tests. I'm posting my work thus far in the hopes of verifying that this approach is acceptable.

@andyjdavis commented on May 10th 2021 Contributor

I have closed that pull request as this is a breaking change that needs to wait for the next major version (5.0.0).

Powered by GitHub Issue Mirror