Page MenuHomePhabricator

API Help should generate [try in ApiSandbox] link to Special:ApiSandbox#action=params from getExamples()
Closed, ResolvedPublic

Description

The API help shown by Special:ApiHelp and action=help includes example API requests. For example Special:ApiHelp/query has this example
api.php?action=query&prop=revisions&meta=siteinfo&titles=Main%20Page&rvprop=user%7Ccomment&continue=
which you can click to see the API response.

This is great but if you want to modify parameters it is fiddly to modify the browser URL. If the wiki has Extension:ApiSandbox it would be nice to provide an extra link "[try in ApiSandbox]".

ApiSandbox supports this \o/ , its doHash() function applies anything in the URL fragment (after the hash mark) to its UI. So take the example URL query string, and append it to Special:ApiSandbox# and we get the desired behavior:
https://www.mediawiki.org/wiki/Special:ApiSandbox#action=query&prop=revisions&meta=siteinfo&titles=Main%20Page&rvprop=user%7Ccomment&continue=

I've added [try in ApiSandbox] to mw.org's Template:ApiEx (T89680).

Details

Related Gerrit Patches:
mediawiki/core : masterAdd Special:ApiSandbox
mediawiki/core : masterApi help examples add links to Special:ApiSandbox
mediawiki/extensions/ApiSandbox : masterAdd link to Special:ApiSandbox to api.php examples

Event Timeline

Spage raised the priority of this task from to Normal.
Spage updated the task description. (Show Details)
Spage added subscribers: Spage, Qgil, Anomie, Aklapper.
gerritbot added a subscriber: gerritbot.

Change 189921 had a related patch set uploaded (by Spage):
Api help examples add links to Special:ApiSandbox

https://gerrit.wikimedia.org/r/189921

Patch-For-Review

For that matter, you could have a similar link in the format=*fm header.

BTW, since ApiSandbox only works with JS, ideally the link would be applied using JS.

For that matter, you could have a similar link in the format=*fm header.

Do you mean a general link to ApiSandbox for the module, e.g. https://www.mediawiki.org/wiki/Special:ApiSandbox#action=query&prop=extracts ?

BTW, since ApiSandbox only works with JS, ideally the link would be applied using JS.

I agree, I responded in gerrit (thanks for your comments).

Spage updated the task description. (Show Details)Feb 16 2015, 11:33 PM

Change 191006 had a related patch set uploaded (by Spage):
Add link to Special:ApiSandbox to api.php examples

https://gerrit.wikimedia.org/r/191006

Patch-For-Review

Spage moved this task from Backlog to Tech on the Web-APIs-Hub board.Feb 17 2015, 10:42 AM
Spage moved this task from Backlog to Doing on the ECT-February-2015 board.
Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.Feb 19 2015, 6:00 PM

T89680: Template:ApiEx on mw.org should have a link to "[view in ApiSandbox]". is more important for the Data & developer hub, but this would still useful.

Spage lowered the priority of this task from Normal to Low.Mar 3 2015, 5:40 AM
Spage moved this task from Backlog to Doing on the ECT-March-2015 board.Mar 3 2015, 5:43 AM

This task was part of ECT-March-2015, and it is still open and assigned. Assuming that it belongs to ECT-April-2015 as well. Otherwise please edit accordingly.

Spage removed Spage as the assignee of this task.Apr 21 2015, 10:15 AM

This feature is unlikely to happen before T89386: Merge ApiSandbox extension into core.

Spage renamed this task from API Help should generate link to Special:ApiSandbox#action=params from getExamples() to API Help should generate [try in ApiSandbox] link to Special:ApiSandbox#action=params from getExamples().Apr 21 2015, 10:16 AM
Spage updated the task description. (Show Details)
Spage removed a project: ECT-April-2015.

Change 209570 had a related patch set uploaded (by Anomie):
Add Special:ApiSandbox

https://gerrit.wikimedia.org/r/209570

Change 209570 merged by jenkins-bot:
Add Special:ApiSandbox

https://gerrit.wikimedia.org/r/209570

Anomie closed this task as Resolved.Feb 3 2016, 5:11 PM
Anomie claimed this task.

Change 191006 abandoned by Anomie:
Add link to Special:ApiSandbox to api.php examples

Reason:
ApiSandbox was merged into core, so this isn't likely to be needed anymore.

https://gerrit.wikimedia.org/r/191006

Change 189921 abandoned by TTO:
Api help examples add links to Special:ApiSandbox

Reason:
Already implemented in a different way.

https://gerrit.wikimedia.org/r/189921