<?xml version="1.0" encoding="utf-8"?>
<api>
<error code="help" info="">
This API allows programs to access various functions of MediaWiki software.
For more details see API Home Page @ http://meta.wikimedia.org/wiki/API
Parameters:
format - The format of the output
action - What action you would like to perform
version - When showing help, include version for each module
*** *** *** *** *** *** *** *** *** *** Modules *** *** *** *** *** *** *** *** *** ***
* action=help *
Display this help screen.
* action=login *
This module is used to login and get the authentication tokens.
Parameters:
lgname - User Name
lgpassword - Password
lgdomain - Domain (optional)
Example:
api.php?action=login&lgname=user&lgpassword=password
* action=query *
Query API module allows applications to get needed pieces of data from the MediaWiki databases,
and is loosely based on the Query API interface currently available on all MediaWiki servers.
All data modifications will first have to use query to acquire a token to prevent abuse from malicious sites.
Parameters:
titles - A list of titles to work on
pageids - A list of page IDs to work on
revids - A list of revision IDs to work on
prop - Which properties to get for the titles/revisions/pageids
list - Which lists to get
meta - Which meta data to get about the site
generator - Use the output of a list as the input for other prop/list/meta items
redirects - Automatically resolve redirects
Example:
api.php?action=query&prop=revisions&meta=siteinfo&titles=Main%20Page&rvprop=user|comment
--- --- --- --- --- --- --- --- Query: Prop --- --- --- --- --- --- --- ---
* prop=info *
Get basic page information such as namespace, title, last touched date, ...
Example:
api.php?action=query&prop=info&titles=Main%20Page
* prop=revisions *
Get revision information.
This module may be used in several ways:
1) Get data about a set of pages (last revision), by setting titles or pageids parameter.
2) Get revisions for one given page, by using titles/pageids with start/end/limit params.
3) Get data about a set of revisions by setting their IDs with revids parameter.
All parameters marked as (enum) may only be used with a single page (#2).
Parameters:
rvprop - Which properties to get for each revision: user|timestamp|comment|content
rvlimit - limit how many revisions will be returned (enum)
rvstartid - from which revision id to start enumeration (enum)
rvendid - stop revision enumeration on this revid (enum)
rvstart - from which revision timestamp to start enumeration (enum)
rvend - enumerate up to this timestamp (enum)
rvdir - direction of enumeration - towards "newer" or "older" revisions (enum)
Examples:
Get data with content for the last revision of titles "API" and "Main Page":
api.php?action=query&prop=revisions&titles=API|Main%20Page&rvprop=timestamp|user|comment|content
Get last 5 revisions of the "Main Page":
api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment
Get first 5 revisions of the "Main Page":
api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer
Get first 5 revisions of the "Main Page" made after 2006-05-01:
api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer&rvstart=20060501000000
--- --- --- --- --- --- --- --- Query: List --- --- --- --- --- --- --- ---
* list=allpages *
Enumerate all pages sequentially in a given namespace
Parameters:
apfrom - The page title to start enumerating from.
apnamespace - The namespace to enumerate. Default 0 (Main).
apfilterredir - Which pages to list: "all" (default), "redirects", or "nonredirects"
aplimit - How many total pages to return
Examples:
Simple Use
api.php?action=query&list=allpages
api.php?action=query&list=allpages&apfrom=B&aplimit=5
Using as Generator
Show info about 4 pages starting at the letter "T"
api.php?action=query&generator=allpages&gaplimit=4&gapfrom=T&prop=info
Show content of first 2 non-redirect pages begining at "Re"
api.php?action=query&generator=allpages&gaplimit=2&gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content
Generator:
This module may be used as a generator
--- --- --- --- --- --- --- --- Query: Meta --- --- --- --- --- --- --- ---
* meta=siteinfo *
Return general information about the site.
Parameters:
siprop - Which sysinfo properties to get:
"general" - Overall system information
"namespaces" - List of registered namespaces (localized)
Example:
api.php?action=query&meta=siteinfo&siprop=general|namespaces
*** *** *** *** *** *** *** *** *** *** Formats *** *** *** *** *** *** *** *** *** ***
* format=json *
Output data in JSON format
Example:
api.php?action=query&meta=siteinfo&si=namespaces&format=json
* format=jsonfm *
Output data in JSON format
Example:
api.php?action=query&meta=siteinfo&si=namespaces&format=jsonfm
* format=xml *
Output data in XML format
Parameters:
xmlindent - Enable XML indentation
Example:
api.php?action=query&meta=siteinfo&si=namespaces&format=xml
* format=xmlfm *
Output data in XML format
Parameters:
xmlindent - Enable XML indentation
Example:
api.php?action=query&meta=siteinfo&si=namespaces&format=xmlfm
* format=yaml *
Output data in YAML format
Example:
api.php?action=query&meta=siteinfo&si=namespaces&format=yaml
* format=yamlfm *
Output data in YAML format
Example:
api.php?action=query&meta=siteinfo&si=namespaces&format=yamlfm
</error>
</api>