Page MenuHomePhabricator

API Sandbox strips out some query parameters
Closed, InvalidPublicBUG REPORT

Description

Steps to Reproduce:
Follow the link https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=linkshere&titles=Ashmolean_Museum&lhnamespace=4&lhshow=!redirect&lhlimit=500

and click "Make request"

Actual Results:
The sandbox link initially strips out the last three parameters from this URL. The Request URL shown in the form stops after &titles=Ashmolean_Museum . So the query run in the API sandbox is different from that intended.

Going directly to the API, this problem does not appear:
https://en.wikipedia.org/w/api.php?action=query&format=json&prop=linkshere&titles=Ashmolean_Museum&lhnamespace=4&lhshow=!redirect&lhlimit=500

Paste the missing parameters onto the end of the Sandbox API URL and click "Make request" again, and the query runs as intended.

Same problem occurs on Commons: https://commons.wikimedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=linkshere&titles=Institution:Ashmolean_Museum&lhshow=!redirect&lhlimit=500
This query is truncated after &titles=Institution:Ashmolean_Museum .

These API Sandbox links are generated by the {{ApiEx}} template on MediaWiki.org. See https://www.mediawiki.org/wiki/User:MartinPoulter#Incoming_links_to_a_Wikipedia_article,_excluding_redirects,_from_pages_in_Wikipedia:_namespace

Expected Results:
The API sandbox should execute the same query as the direct link to the API, with all the parameters, without needing to be reloaded.

Event Timeline

Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptMay 19 2019, 9:56 AM
matmarex added a subscriber: matmarex.

I can't reproduce the problem. The links you give work perfectly for me. Recording:

Thanks for testing in Opera. The bug is definitely happening on Chrome for Windows.

Further finding: the first time I press "Make request", the fields are stripped out. When I press that button again, the fields reappear. Pressing the button more times and all the fields remain. It is only on the first press of the button that the error happens.

Anomie closed this task as Invalid.May 23 2019, 4:24 PM
Anomie added a subscriber: Anomie.

Can't reproduce with Firefox 66 or Chromium 74.

The problem you describe could happen if you don't wait for the sandbox to fully load the data.

  1. It first has to load the data for the 'main' module to find out its parameters, at which point it discovers that "action=query" and "format=json" are submodule parameters.
  2. So then it has to load the data for the 'query' and 'json' modules to find out their parameters, at which point it discovers that "prop=linkshere" is another submodule parameter.
  3. So then it has to load the data for 'query+linkshere' to find out that module's parameters.

If you were to click "Make request" before step 3 completes, it won't have the parameter data for the module loaded to know to include the parameters in the request.

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptMay 23 2019, 4:24 PM