Filter_sort_order not working on VisitsSummary.get

I am trying the get the VisitSummary.get in order of date yet when I use the filter_sort_order parameter I get the same response whether ASC or DESC. Am I doing something wrong?

https://demo.piwik.org/?module=API&method=VisitsSummary.get&idSite=7&period=month&date=last30&format=xml&token_auth=anonymous&filter_sort_column=date&filter_sort_order=asc

Thank you in advance

Hi,

It seems like the filter_sort_column doesn’t work at all in combination with date=last30.
https://demo.piwik.org/?module=API&method=VisitsSummary.get&idSite=7&period=month&date=last30&format=html&token_auth=anonymous&filter_sort_column=nb_visits&filter_sort_order=desc
Unfortunately I don’t know enough about the the API to answer if this is intentional or a bug.

Can you create a Github issue:

Thank you Lukas, I have added to Github.

Hi, it is expected that the reports are listed by date. Here the report has no dimension (only main metrics). A report with dimension is sorted but does sort each dataTable within a date… https://demo.piwik.org/?module=API&method=Actions.getPageUrls&idSite=7&period=month&date=last30&format=json&token_auth=anonymous&filter_sort_column=nb_visits&filter_sort_order=desc

So basically the sorting is applied to data of each individual day and because VisitsSummary.get has no multiple rows, there is nothing sorted.

Applying the sort filter to the dates for reports without a dimension won’t be a solution since we need consistent sorting behaviour for reports with and without a dimension. It would be a new feature to make this sortable and would need a new API parameter

1 Like

Thank you Thomas, that makes perfect sense. I came to a solution with krsort($content); in PHP, but with your comments may sort by using JS to define a date range in the API URL.

Have a great Xmas and New Year.