API:Meta
From MediaWiki.org
(Redirected from API:Query - Meta)
| This page is part of the MediaWiki API documentation. |
| Language: | English • Deutsch • Español • 日本語 |
|---|
Quick overview:
- Quick start guide
- FAQ
- Formats
- Error reporting
- Restricting usage
- Authentication
- Queries
- Meta information
- Properties
- Lists
- Search suggestions
- Expanding templates and rendering
- Purging pages' caches
- Parameter information
- Changing wiki content
- Watchlist feed
- Extensions
- Using the API in MediaWiki and extensions
- Miscellaneous
- Implementation
- Client code
Meta queries return information which is not associated with pages.
Contents |
[edit] siteinfo / si
| MediaWiki version: | 1.8 |
Siteinfo returns overall site information. The code for the siteinfo function is located at ApiQuerySiteinfo.php.
[edit] Siteinfo: Parameters
siprop: Which properties to getgeneral: General site information (default)namespaces: Provides a list of all namespaces.- Each namespace is given within its own element, which contains several attributes:
idan integer identification number which is unique for each namespace.subpagesif present, will always be a null attribute (subpages=""). This attribute indicates that subpages are allowed within the namespace. (MW 1.13+)canonicalProvides 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+)contentif 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+)caseEither "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-sensitive" is reserved for future use (MW 1.16+)
- Each namespace is given within its own element, which contains several attributes:
statistics: Site statistics in Special:Statistics, plus job queue (MW 1.11+)dbrepllag: Ifsishowalldbis not set, provides information about the database server with the highest replication lag. Ifsishowalldbis 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
iwelement include:prefixIs the prefix of the interwiki link; this is used the same way as a namespace is used when editing.local(if true) A boolean value indicating whether the wiki is in this project.urlThe URL of the wiki, with "$1" as a placeholder for an article name.language(if defined) The name of the language used by the wiki. (MW 1.13+)wikiidThe internal name of the database. (MW 1.18+)apiThe URL of the file api.php. (MW 1.18+)
- The attributes provided in each
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+)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+)languages: Get available languages as seen in preferences (MW 1.16+)
sifilteriw: Criteria to filter the interwiki map by (ignored ifsiprop=interwikimapisn'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 ifsiprop=dbrepllagisn't set) (MW 1.11+)sinumberingroup: When set to true andsipropincludesusergroupsthe number of users in each usergroup and the groups it can add/remove are included (MW 1.17+)
[edit] Siteinfo: Example
General site info
<?xml version="1.0" encoding="utf-8"?> <api> <query> <general mainpage="Main Page" base="http://en.wikipedia.org/wiki/Main_Page" sitename="Wikipedia" generator="MediaWiki 1.16alpha-wmf" phpversion="5.2.4-2ubuntu5wm1" phpsapi="apache2handler" dbtype="mysql" dbversion="4.0.40-wikimedia-log" rev="54192" case="first-letter" rights="Creative Commons Attribution-Share Alike 3.0 Unported" lang="en" fallback8bitEncoding="windows-1252" writeapi="" timezone="UTC" timeoffset="0" articlepath="/wiki/$1" scriptpath="/w" script="/w/index.php" variantarticlepath="" server="http://en.wikipedia.org" wikiid="enwiki" /> </query> </api>
Specific site info
<?xml version="1.0"?> <api> <query> <statistics pages="25546702" articles="3801962" edits="499158028" images="825487" users="15733405" activeusers="144787" admins="1514" jobs="0" /> </query> </api>
[edit] Siteinfo: Possible errors
- code: includeAllDenied
- info: Cannot view all servers info unless $wgShowHostnames is true
[edit] userinfo / ui
| MediaWiki version: | 1.11 |
Returns information about the currently logged-in user. The code for the userinfo function is located at ApiQueryUserInfo.php.
[edit] Parameters
uiprop: Which properties to getblockinfo: Whether the current user is blocked, by whom, and whyhasmsg: Whether the current user has new messages on their user talk pagegroups: Which groups the current user belongs torights: Which rights the current user haschangeablegroups: Which groups the current user can add/removeoptions: Which preferences the current user haseditcount: The number of edits the current user has maderatelimits: Rate limits applying to the current userrealname: User's realname [1.18+]r79433email: Email address and authentication timestamp in ISO 8601 format [1.15+]
[edit] Example
General user info
<?xml version="1.0" encoding="utf-8"?> <api> <query> <userinfo name="Jborme" messages=""> <rights> <r>createaccount</r> <r>read</r> <r>edit</r> <r>createpage</r> <r>createtalk</r> <r>reupload-own</r> <r>read</r> <r>edit</r> <r>createpage</r> <r>createtalk</r> <r>upload</r> <r>minoredit</r> <r>purge</r> <r>reupload</r> <r>move</r> <r>autoconfirmed</r> <r>skipcaptcha</r> <r>emailconfirmed</r> </rights> </userinfo> </query> </api>
[edit] Possible errors
None.
[edit] allmessages / am
| MediaWiki version: | 1.12 |
Lists the contents of all (or a few) interface messages.
[edit] Parameters
ammessages: Which messages to output. "*" (default) means all messagesamprop: Which properties to get, the only (default) prop is "default"- 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.amargs: Arguments to be substituted into messageamfilter: Return only messages that contain this stringamlang: Return messages in this languageamfrom: Return messages starting at this messageamto: Return messages ending at this message
[edit] Example
Get the Dutch translations of some messages
<?xml version="1.0" encoding="utf-8"?> <api> <query> <allmessages> <message name="august">augustus</message> <message name="mainpage">Hoofdpagina</message> <message name="edit">Bewerken</message> <message name="rollback-success">Wijzigingen door $1 teruggedraaid; laatste versie van $2 hersteld.</message> <message name="thismessagedoesntexist" missing="" /> </allmessages> </query> </api>
[edit] Possible errors
None.