Wiki API

From Biowikifarm Metawiki
Jump to: navigation, search

The MediaWiki software can be used as a service-oriented architecture, providing services to obtain pages as htlm without skin, raw text content, to update information, get lists of categories or links on a page, etc. Creating a bot describes the use of APIs in detail, including how to create and use the edit tokens. A "bot" is a colloquial term for software that works against MediaWiki as a service.

The primary interfaces are the normal index.php (URL-parameter) API and a special API.php interfaces (returning various formats such as xml or JSON).

index.php

See the documentation parameters to index.php.

Especially useful parameters are:

Status of API: Deprecated for software interaction.

api.php

This is a special software API to MediaWiki allowing to login, read, and write pages in xml or json. By default, API is turned on for read and off for write. Most Wikimedia foundation wikis have write API turned on.

Examples:

Note: the edit API does not use xml, but uploads the raw page content directly, very similar to the index.php API!

Status of API: Recommended.

On the current Key to Nature site the API is not usable due to an old version of MediaWiki running. Therefore, the examples currently run against the separate KeyToNature Test wiki.