Template talk:API-head

From MediaWiki.org
Jump to navigation Jump to search

Add a sourcefile parameter, and class[edit]

The page API:Info has

The code for retrieving page properties is located on the git repository at ApiQueryInfo.php.

I think an optional link to source code is useful and should be generalized as an optional sourcefile parameter to this template

Simultaneously, the generated api.php?action=help doc knows what class and file output it, so it could probably output

Implemented in __FILE__

We could likewise provide links into the doxgen generated doc, e.g. for ApiQueryInfo it's at https://doc.wikimedia.org/mediawiki-core/master/php/html/classApiQueryInfo.html . I'm not sure how regular the translation from filename to doxygen class file is,

-- SPage (WMF) (talk) 09:40, 7 April 2015 (UTC)

Needs a wiki (or lang/site) parameter[edit]

This template hardcodes //www.mediawiki.org/w/api.php?action=help] for its "Generated help" link. But many extensions and thus API modules aren't available on mediawiki.org, such as list=gettingstartedgetpages and Wikidata's Wikibase APIs. Like {{ApiEx}}, this template must allow you to specify a different wiki for generated help links. {{ApiEx}} accepts lang=en and site=en.wikipedia.org parameters. -- SPage (WMF) (talk) 01:35, 29 May 2015 (UTC)

I added site=en.wikipedia.org, Extension:GettingStarted#API uses it, but I can't tell if it works or I broke something until the mysterious ways of Extension:Translation and FuzzyBot occur. -- SPage (WMF) (talk) 02:14, 29 May 2015 (UTC)

Empty parameters[edit]

I tried changing the code to handle empty parameters (e.g. {{API-head|prefix=}}), but rather bizarrely, it appears something to do with translation is causing it not to work. If I take all the <translate> codes out, it works as expected. Since the code changes aren't harming anything, I've left them in place, in the hopes that someday the issue will be fixed. Robin Hood  (talk) 07:32, 6 November 2015 (UTC)