Page MenuHomePhabricator

[Legacy] Making request to invalid start and end time date format displays only start time warning
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Make a request to the legacy endpoint with invalid start and end date formats

What happens?:

  • Only the start time warning is displayed

What should have happened instead?:

  • start time and end warning should be displayed at the same time

Software version (skip for WMF-hosted wikis like Wikipedia):
legacy AQS service

Other information (browser name/version, screenshots, etc.):
Code used for Prod:

Request

import requests

prod_url = 'https://wikimedia.org/api/rest_v1/metrics/legacy/pagecounts/aggregate/en.wikipedia.org/all-sites/daily/20140101/20140101'

header = {"accept": "application/json",
          "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"}

response = requests.get(prod_url, headers=header)

print(response.status_code)
print(response.json())

Prod response:

{
   "type":"https://mediawiki.org/wiki/HyperSwitch/errors/invalid_request",
   "method":"get",
   "detail":[
      "start timestamp is invalid, must be a valid date in YYYYMMDDHH format",
      "end timestamp is invalid, must be a valid date in YYYYMMDDHH format"
   ],
   "uri":"/analytics.wikimedia.org/v1/legacy/pagecounts/aggregate/en.wikipedia.org/all-sites/daily/20140101/20140101"
}

AQS 2.0 Response:

{
   "detail":"start timestamp is invalid, must be a valid date in YYYYMMDDHH format",
   "method":"get",
   "status":400,
   "title":"Bad Request",
   "type":"about:blank",
   "uri":"/metrics/legacy/pagecounts/aggregate/en.wikipedia.org/all-sites/daily/20140101/20140101"
}

Its better to show the errors all at once just as it is shown in prod.

Event Timeline

Detail property is no longer an array in AQS 2.0. It's something already discussed.

We discussed about it some months ago via Slack (https://wikimedia.slack.com/archives/C040Q9JSC9Z/p1684234492277249) and Bill shared with us the link to the phabricator task T302536: Problem details for HTTP APIs (rfc7807) where that decision was taken last year.

That's why we only can show a message at the same time for all errors and services.

Ok that makes sense.. thanks for clarying. I will close this.