API:Meta

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

Quick overview:

v · d · e

Meta queries return information which is not associated with pages.

siteinfo / si[edit | edit source]

MediaWiki version: 1.8

Siteinfo returns overall site information. The code for the siteinfo function is located at ApiQuerySiteinfo.php.

Parameters[edit | edit source]

  • siprop: Which properties to get
    • general: General site information (default)
      • articlepath $wgArticlePath MW 1.15+
      • base
      • case
      • dbtype
      • dbversion
      • externalimages
      • fallback
      • fallback8bitEncoding
      • favicon
      • imagelimits
      • imagewhitelistenabled (boolean)
      • generator
      • git-branch
      • git-hash
      • lang MW 1.10+
      • langconversion
      • linkprefix MW 1.21+
      • linkprefixcharset
      • linktrail MW 1.21+
      • logo
      • mainpage
      • maxuploadsize $wgMaxUploadSize
      • misermode MW 1.18+
      • phpsapi
      • phpversion
      • readonly MW 1.13+
      • readonlyreason MW 1.13+
      • rights $wgRightsText
      • rightscode $wgRightsCode MW 1.15+
      • rtl
      • server $wgServer MW 1.15+
      • servername
      • script $wgScript MW 1.15+
      • scriptpath $wgScriptPath MW 1.15+
      • sitename
      • thumblimits
      • time MW 1.16+
      • timeoffset MW 1.13+
      • timezone MW 1.13+
      • titleconversion
      • variantarticlepath $wgVariantArticlePath MW 1.15+
      • variants
      • wikiid wfWikiID() MW 1.15+
      • writeapi MW 1.13+
    • namespaces: Provides a list of all namespaces.
      Each namespace is given within its own element, which contains several attributes:
      • id an integer identification number which is unique for each namespace.
      • subpages if present, will always be a null attribute (subpages=""). This attribute indicates that subpages are allowed within the namespace. MW 1.13+
      • canonical Provides the canonical namespace name of the namespace, which may or may not be the same as the actual namespace name. For example, all wikis have a "Project:" namespace, but the actual namespace name is normally changed to the name of the wiki (on Wikipedia for example, the "Project:" namespace is "Wikipedia:"). MW 1.14+
      • content if present, will always be a null attribute (content=""). This attribute indicates that pages within this namespace should be treated as the main content of the wiki. Pages within namespaces with the content value set are counted for statistical purposes, among other things. MW 1.16+
      • case Either "first-letter" or "case-sensitive". If the first letter of the namespace name is capitalized (the default), then the value of this attribute will be "first-letter". Otherwise, the value will be "case-sensitive" in order to indicate that the namespace name in question intentionally does not use a capital first letter. Note: "case-insensitive" is reserved for future use MW 1.16+
    • statistics: Site statistics in Special:Statistics, plus job queue MW 1.11+
      • Note: For historical reasons, the number of files on the wiki is labelled as images not files. This number refers to uploaded files of all types, not just images.
    • dbrepllag: If sishowalldb is not set, provides information about the database server with the highest replication lag. If sishowalldb is set, shows replication lag for each database server. MW 1.11+
    • interwikimap: A list of each interwiki prefix, provided within its own element. MW 1.11+
      The attributes provided in each iw element include:
      • prefix Is the prefix of the interwiki link; this is used the same way as a namespace is used when editing.
      • local: If the interwiki prefix points to a site belonging to the current wiki farm, this will be set to an empty string. The value is read straight out of the iw_local column of the interwiki table.
      • trans: If transcluding pages from this wiki is allowed, this will be set to an empty string. Note that this has no effect unless crosswiki transclusion is enabled on the current wiki. MW 1.23+
      • url The URL of the wiki, with "$1" as a placeholder for an article name.
      • protorel: If the value of url is protocol-relative (begins with //), this will be set to an empty string MW 1.24+ or the value "true" MW 1.23 and prior).
      • language If the interwiki prefix is a language code defined in Language::fetchLanguageNames() from $wgExtraLanguageNames, this will be the name of that language. MW 1.13+
      • extralanglink: If the interwiki prefix is to be considered a language link, despite the prefix not matching a known language code, this will be set to an empty string. MW 1.24+
      • linktext: If the interwiki prefix is an extra language link, this will contain the display text used for the links. MW 1.24+
      • sitename: If the interwiki prefix is an extra language link, this will contain the friendly site name used in the tooltip text of the links. MW 1.24+
      • wikiid The internal name of the database. Not filled in by default; it may be missing for you. The value is read straight out of the iw_wikiid column of the interwiki table. MW 1.18+
      • api The URL of the file api.php on that wiki. Not filled in by default; it may be missing for you. The value is read straight out of the iw_api column of the interwiki table. MW 1.18+
    • namespacealiases: A list of all namespace aliases MW 1.13+
    • specialpagealiases: A list of all special page aliases MW 1.13+
    • usergroups: A list of all user groups and their permissions MW 1.13+
    • extensions: A list of extensions installed on the wiki MW 1.14+ including revision (date and hash) and, if possible, licensing information (MW 1.23+)
    • skins: A list of skins installed on the wiki MW 1.18+
    • magicwords: A list of magic words and their aliases MW 1.14+
    • fileextensions: A list of file extensions allowed to be uploaded MW 1.15+
    • rightsinfo: Get information about the license governing the wiki's content MW 1.15+
      • In the best case this will provide:
        • url which is what $wgRightsUrl contains (like a license URL)
        • text which is what $wgRightsText contains (like the license name) and is also provided with general
      • If $wgRightsPage is set, url is the URL to a page whose meaning has to be interpreted separately and is not output by the API
      • The API doesn't output whatever MediaWiki:Copyright contains
    • languages: Get available languages as seen in preferences MW 1.16+
  • sifilteriw: Criteria to filter the interwiki map by (ignored if siprop=interwikimap isn't set) MW 1.11+
    • local: Only list local interwiki prefixes
    • !local: Only list non-local interwiki prefixes
  • sishowalldb: Show information about all DB servers (ignored if siprop=dbrepllag isn't set) MW 1.11+
  • sinumberingroup: When set to true and siprop includes usergroups the number of users in each usergroup and the groups it can add/remove are included MW 1.17+

Example[edit | edit source]

General site info

Specific site info

Copyright site info

List namespaces and aliases

Possible errors[edit | edit source]

Code Info
includeAllDenied Cannot view all servers info unless $wgShowHostnames is true

userinfo / ui[edit | edit source]

MediaWiki version: 1.11

Returns information about the currently logged-in user. The code for the userinfo function is located at ApiQueryUserInfo.php.

Parameters[edit | edit source]

  • uiprop: Which properties to get
    • blockinfo: Whether the current user is blocked, by whom, and why
    • hasmsg: Whether the current user has new messages on their user talk page
    • groups: Which groups the current user belongs to
    • implicitgroups: Lists all the groups the current user is automatically a member of MW 1.18+
    • rights: Which rights the current user has
    • changeablegroups: Which groups the current user can add/remove MW 1.16+
    • options: Which preferences the current user has
    • preferencestoken: Get a token to change current user's preferences MW 1.14+
    • editcount: The number of edits the current user has made MW 1.12+
    • ratelimits: Rate limits applying to the current user MW 1.12+
    • realname: User's realname MW 1.18+
    • email: Email address and authentication timestamp in ISO 8601 format MW 1.15+
    • acceptlang: Echoes the Accept-Language header sent by the client in a structured format MW 1.17+
    • registrationdate: Adds the user's registration date MW 1.18+
    • unreadcount: Adds the count of unread pages on the user's watchlist (maximum 999; returns "1000+" if more) MW 1.24+

Example[edit | edit source]

General user info

Possible errors[edit | edit source]

None.

allmessages / am[edit | edit source]

MediaWiki version: 1.12

Lists the contents of all (or a few) interface messages.

Parameters[edit | edit source]

  • ammessages: Which messages to output. "*" (default) means all messages
  • amprop: Which properties to get, the only (default) prop is "default" MW 1.16+
    • When the default is identical to the (custom) message, the prop is not added
  • amenableparser: Set to enable parser, will preprocess the wikitext of message. Will substitute magic words, handle templates etc. MW 1.16+
  • amnocontent: If set, do not include the content of the messages in the output. MW 1.19+
  • amincludelocal: Also include local messages, i.e. messages that don't exist in the software but do exist as a MediaWiki: page. This lists all MediaWiki: pages, so it will also list those that aren't 'really' messages such as Common.js MW 1.19+
  • amtitle: Page name to use as context when parsing message (for enableparser option) MW 1.18+
  • amargs: Arguments to be substituted into message MW 1.16+
  • amprefix: Return messages with this prefix MW 1.18+
  • amfilter: Return only messages with names that contain this string
  • amcustomised: Return only messages in this customisation state MW 1.18+
  • amlang: Return messages in this language
  • amfrom: Return messages starting at this message (must be a valid message name) MW 1.15+
  • amto: Return messages ending at this message (must be a valid message name) MW 1.17+

Example[edit | edit source]

Get the Dutch translations of some messages

Possible errors[edit | edit source]

None.

filerepoinfo / fri[edit | edit source]

MediaWiki version: 1.22

Return meta information about image repositories configured on the wiki.

Parameters[edit | edit source]

  • friprop: Which repository properties to get (there may be more available on some wikis):
    • apiurl: URL to the repository API - helpful for getting image info from the host.
    • name: The key of the repository - used in e.g. $wgForeignFileRepos and imageinfo return values.
    • displayname: The human-readable name of the repository wiki.
    • rooturl: Root URL for image paths.
    • local: Whether that repository is the local one or not.

Example[edit | edit source]

Possible errors[edit | edit source]

Unknown.

tokens[edit | edit source]

MediaWiki version: 1.24

Gets tokens for data-modifying actions. This module does not use a prefix. The csrf (cross-site request forgery) token corresponds to the majority of older tokens, like edittoken and movetoken.

Parameters[edit | edit source]

  • type: Type of token(s) to request. Possible values: csrf, watch, patrol, rollback, userrights. (Default: csrf)

Example[edit | edit source]


Possible errors[edit | edit source]

Unknown.