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

API should not prettify labels when requesting period=week with many periods #7480

Closed
tsteur opened this Issue Mar 19, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@tsteur
Copy link
Member

commented Mar 19, 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

@tsteur tsteur added this to the Piwik 3.0.0 milestone Mar 19, 2015

@mattab mattab added the Help wanted label Aug 13, 2015

@mattab mattab modified the milestones: 3.0.0-b2, 3.0.0 Feb 8, 2016

tsteur added a commit that referenced this issue Aug 8, 2016

@tsteur tsteur self-assigned this Aug 8, 2016

@tsteur tsteur closed this in 9df0763 Oct 3, 2016

@mattab mattab modified the milestones: 3.0.0-b1, 3.0.0-b2 Oct 5, 2016

@mattab mattab added the Major label Oct 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.