Navigation Menu

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

When API returns a datatable that has only one column, column name is "value" #7051

Open
tsteur opened this issue Jan 19, 2015 · 6 comments
Open
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Jan 19, 2015

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

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Jan 19, 2015
@diosmosis
Copy link
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 mattab added this to the Piwik 3.0.0 milestone Feb 7, 2015
@mattab
Copy link
Member

mattab commented Feb 7, 2015

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

@andyjdavis
Copy link
Contributor

andyjdavis commented May 6, 2021

@andyjdavis
Copy link
Contributor

Here is a possible fix for this. #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
Copy link
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).

@mattab
Copy link
Member

mattab commented Apr 3, 2023

We're thinking we need to postpone this to Matomo 6.0.0 due to lack of time.

@mattab mattab modified the milestones: 5.0.0, 6.0.0 Apr 3, 2023
@mattab mattab removed the 5.0.0 label Aug 4, 2023
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants