Steps to replicate the issue (include links if applicable):
- Make request call to the pageviews endpoint with invalid project
- Code below:
import requests prod_url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/top/invalid_project_xx/all-access/2019/01/02' 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())
What happens?:
in AQS 2.0 this returns reference message to data and country missing
{ "detail":"The date(s) you used are valid, but we either do not have data for those date(s), or the country you asked for is not loaded yet. Please check documentation for more information.", "method":"get", "status":404, "title":"Not Found", "type":"about:blank", "uri":"/metrics/pageviews/top/invalid_project_xx/all-access/2019/01/02" }
What should have happened instead?:
This should return reference to data/project missing
{ "type":"https://mediawiki.org/wiki/HyperSwitch/errors/not_found", "title":"Not found.", "method":"get", "detail":"The date(s) you used are valid, but we either do not have data for those date(s), or the project you asked for is not loaded yet. Please check https://wikimedia.org/api/rest_v1/?doc for more information.", "uri":"/analytics.wikimedia.org/v1/pageviews/top/invalid_project_xx/all-access/2019/01/02" }
Software version (skip for WMF-hosted wikis like Wikipedia):
Pageviews_top service