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 · Fixed by #10381
Closed

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

tsteur opened this issue Mar 19, 2015 · 0 comments · Fixed by #10381
Assignees
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@tsteur
Copy link
Member

tsteur 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 Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. c: Usability For issues that let users achieve a defined goal more effectively or efficiently. labels Mar 19, 2015
@tsteur tsteur added this to the Piwik 3.0.0 milestone Mar 19, 2015
@mattab mattab added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. 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 as completed 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 Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Oct 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants