Page MenuHomePhabricator

20160431 produces "end timestamp is invalid, must be a valid date in YYYYMMDD format"
Open, Needs TriagePublic

Description

https://tools.wmflabs.org/glamtools/treeviews/?q=%7B%22lang%22%3A%22it%22%2C%22pagepile%22%3A%22492%22%2C%22rows%22%3A%5B%5D%7D will make requests such as https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/it.wikipedia/all-access/user/Antonio_De_Gennaro/daily/20160401/20160431 At the third attempt, I got 408 pages with views in April, but that error message "end timestamp is invalid, must be a valid date in YYYYMMDD format" is unhelpful. The request shouldn't be made invalid by a numerical range which is too wide (i.e. which includes non-existing days) .

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald Transcript

April has only 30 days, not 31...

If you think anything in this report suggests otherwise, please fix. It seemed obvious enough to me, so I don't know what to change.

Pageview API is reporting an error as it should, this should likely be filed as a bug on the tool itself.

Nuria added a project: Analytics.
Nuria moved this task from Incoming to Radar on the Analytics board.
Nuria added a subscriber: MusikAnimal.

@Nemo_bis: the query asks for 20160401 through 20160431, and 20160431 is not a valid date, in case that wasn't obvious in what Danny_B was saying.

@Nemo_bis: the query asks for 20160401 through 20160431, and 20160431 is not a valid date, in case that wasn't obvious in what Danny_B was saying.

It is obvious, but it has nothing to do with my request. P.s.: Hopefully now my use of adjectives is clearer.

@Nemo_bis And what would you suggest instead of invalid report?

@Nemo_bis And what would you suggest instead of invalid report?

One option is to simply perform a numerical comparison and include all the valid dates in the integer range.

Oh I see, if the request is to not validate dates, then I would personally decline that. We validate parameters to make sure the user is asking for what they want. If they're typing these numbers by hand they might make a typo that causes them to return way too much data. We'll be adding limits to how much data can be retrieved at any one time, but still, it might be more data than they need by far. That's what validation is for, to catch simple mistakes. I'm not seeing the argument here, but I'll leave it open in case you have examples of similar implementations that ignore parameter validation.