API:Main page

 MediaWiki has three interfaces:
 * the MediaWiki API, which provides convenient access to wiki features, data and meta-data. Read this article for an overview of the API.
 * the Special:Export page, which provides bulk export of wiki content as XML. Read the Export help article on meta.wikimedia.org for more information.
 * the standard web-based interface (which you are likely using right now). Read Manual:Parameters to index.php for information on using the web-based interface.

See the menu bar on the right for the API sub-topics.

The goal of this API (Application Programming Interface) is to provide direct, high-level access to the data contained in the MediaWiki databases. Client programs can use the API to login, get data, and post changes. The API supports thin web-based JavaScript clients, such as Navigation popups or LiveRC, end-user applications (such as vandal fighter), and can be accessed by another web site (tool server's utilities).

Output from the API is available in a wide range of formats, including JSON, WDDX, XML, YAML and PHP's native serialization format.

Each API module uses a set of parameters. To prevent name collision, each submodule of action=query has a two letter abbreviation, and each parameter name begins with those two letters.


 * Short help and parameter guide can be obtained from the api itself
 * Mailing List for notifications and questions: API mailing list
 * Low-traffic mailing list for announcements only (all posts to this list are posted to mediawiki-api as well): mediawiki-api-announce
 * View and report API bugs: BugZilla (When reporting new bugs, don't forget to set Component=API)

Useful parameters

 * Maxlag - The API can respect the maxlag parameter, which in the case of database replicated setups, such as the Wikimedia cluster, will make the API prevent your request from occurring if 1 or more slave database servers are over the specified lag value. Beware that, whereas the Wikipedia UI returns a HTTP 503 for maxlag errors, the API returns a 200 OK with an error in the response.

Erroneous requests
When the API is sent an erroneous request, a HTTP Header will be set with the key "MediaWiki-API-Error" and the value of the error code.

In the case of an invalid action being sent, the value of both will be "unknown_action".

Useful Links

 * API Live
 * API source code in SVN
 * Database layout
 * The current DB schema in SVN
 * Creating a Bot howto

Archive

 * API:Wikimania 2006 API discussion