Template talk:API

From mediawiki.org
Latest comment: 2 years ago by Tacsipacsi in topic Broken link - Implementation Strategy

This template stopped working on API pages. Clicking another language brings up the template itself. ??? --Yurik 01:00, 14 September 2007 (UTC)Reply[reply]

bug when used with ApiEx-template[edit]

{{ApiEx}} (see API:Options as example) have width 100% and so they will drop below the API-navigation box and there is empty hole in the page. --Zache (talk) 19:41, 14 June 2014 (UTC)Reply[reply]

I don't see that any more, they fit alongside. Looks like User:Fred Gandt fixed it in revision 1055459 in July 2014 with 'addition of "overflow:auto" to eradicate expanses of white-space.' -- SPage (WMF) (talk) 07:01, 10 August 2015 (UTC)Reply[reply]


With {{API-head}} being added to pages, there's now two infoboxes side-by-side, which looks terrible. This should be changed to a navbox style and moved to the bottom of the page or merged with API-head. -- 04:54, 22 February 2015 (UTC)Reply[reply]

Yes, we need to do something, it's getting unwieldy -- SPage (WMF) (talk)

MediaWiki APIs and the PHP action API[edit]

I'm organizing content in the API: namespace, phab:T105133. With RESTBase we have more than just api.php, so in revision 1825996 of Template:API I adjusted the menu to be more general but then have a heading specifically for the "PHP action API". I mentioned this name in the (reactivated) mailing list thread wikitech-l mailing list thread 'Bikeshedding a good name for "the api.php API'. -- SPage (WMF) (talk) 06:56, 10 August 2015 (UTC)Reply[reply]

Proposal to improve this[edit]

  1. Add an option for type, default "action" to the template: {{API|type=action}}. If type is not action, then the template will not display the horizontal
    "This page is part of the MediaWiki action API documentation."
    • This seems really hard to do because of convoluted wiki syntax and i18n interactions. See attempt at {{API-navtest}}. It seems easier to split out the banner to {{API-action-banner}} and modify most API pages to separately invoke it as well as {{API}}.
  2. Add an an option for collapsed, if set the navigation sidebar is collapsed. That would allow adding the navigation to API:Web APIs hub without uglifying its experience. Maybe make it look better, the current <div class="NavBar"></div> is a tired over-bordered lilac color,

3. a proper menu bar[edit]

What I'd really like to do is make this an actual menu bar:

 MediaWiki APIs ▼: action API ▼ | RESTBase ▼ | Wikidata Query Service ▼

with dropdowns for each. The first "MediaWiki APIs" dropdown would have some generic pages like Etiquette and the second would have most of the current enormous navigation. The template's type parameter (general, action, RESTBase, WDQS) would bold the matching menu bar item. (For some reason, https://en.wikipedia.org/api/ is using this acid green color.)

I don't know if there's JavaScript support for such a menu bar, it might be doable in pure CSS. Eventually, phab:T101666 "Create parser tag(s) that render OOUI PHP widgets" should help.

-- SPage (WMF) (talk) 05:41, 28 September 2015 (UTC)Reply[reply]

Broken link - can't determine cause[edit]

Something is broken with the entry

  • [[Special:MyLanguage/API:Parameter information|]]

which is displaying as plain wikitext, but I can't determine what the problem is. Help? Quiddity (WMF) (talk) 06:05, 1 August 2017 (UTC)Reply[reply]

The pipe trick [[foo|]] only works when content is saved, but never when it is dynamically generated by a template. In other words wikitext can never be saved with a pipe trick unless it is escaped. The fix should probably be made in Template:Localized_link or this template, so it assigns some caption or text to the link whenever it is empty. 07:31, 1 August 2017 (UTC)

Broken link - Implementation Strategy[edit]

In the Developer Utilities section of this template, the last entry is rendered as "[[Special:MyLanguage/API:Implementation Strategy|]]". Don't see why, it's formatted same as other bulleted entries. --Xymph (talk) 15:59, 2 July 2021 (UTC)Reply[reply]

@Xymph: Yes Fixed by Clump with this edit—the template applies the {{PAGENAME:}} magic word to this page’s content internally, and the magic word outputs nothing on invalid titles like those that contain line breaks. —Tacsipacsi (talk) 14:54, 3 July 2021 (UTC)Reply[reply]