@tsteur opened this issue on March 19th 2015

Example URL: http://demo.piwik.org/index.php?module=API&method=Resolution.getResolution&idSite=7&period=week&date=last10&format=JSON

This does the following:

{
"From 2015-01-12 to 2015-01-18": [...data...]",
"From 2015-01-19 to 2015-01-25": [...data...],
...
}

instead it should do for example

{
"2015-01-12,2015-01-18": [...data...]",
"2015-01-19,2015-01-25": [...data...],
...
}

For Month we already return "2014-06" but maybe it makes sense to return "2014-06-01,2014-06-30". Not sure! Similar for year etc.

While the prettified label is kinda nice when exporting data, it is not nice to use in third apps such as Piwik Mobile etc since for example the label changes when requesting with a different language see language=nl http://demo.piwik.org/index.php?module=API&method=Resolution.getResolution&idSite=7&period=week&date=last10&format=JSON&language=nl

Which returns Van 2015-01-12 tot 2015-01-18 as a label. Meaning one can never really access the requested period directly etc. since it depends on the language. If we change the language key it would even break the API. This means any translator can break the API etc.

Moving to Piwik 3.0 as it is a breaking change.

In case someone is wondering I think the logic for this is here: https://github.com/piwik/piwik/blob/2.12.0-b8/core/Archive/DataTableFactory.php#L385

This issue was closed on October 3rd 2016
Powered by GitHub Issue Mirror