API:Opensearch

From MediaWiki.org
Jump to: navigation, search
MediaWiki version: 1.9
Tools clipart.png This page is part of the MediaWiki API documentation.
MediaWiki API

Quick overview:

v · d · e

Parameters[edit | edit source]

  • search – the search string
  • limit – maximum amount of results to return (defaults to 10; maximum 15)
  • namespacenamespace numbers to search (delimited by |, defaults to 0)
  • suggest – do nothing if $wgEnableOpenSearchSuggest is false
  • format – see below

Error Codes[edit | edit source]

Code Info
readapidenied You need read permission to use this module.

Note on case sensitivity[edit | edit source]

Page name searches are case-sensitive. If $wgCapitalLinks is true (this is the default), the first letter is case-insensitive. If the TitleKey extension is enabled, page name searches are entirely case-insensitive.

Example[edit | edit source]

The opensearch API module handles formats differently. Only XML and JSON (and their formatted versions) are recognized, every other valid format parameter results in JSON. The JSON format returns an array containing the search query and an array of result titles: JSON

Furthermore, the XML format returns an OpenSearch XML file with titles, URLs and short descriptions when OpenSearchXml extension is loaded: XML

See also[edit | edit source]