API:Data formats

Input
The API takes its input through parameters in the query string. Every module (and every action=query submodule) has its own set of parameters, which is listed in the documentation and in action=help, and can be retrieved through action=paraminfo.

Multivalue parameters
Some parameters take multiple values, separated by a pipe character. Whether a parameter accepts multiple values is listed explicitly in  and. The documentation does not distinguish multivalue parameters explicitly, but the descriptions for these parameters are usually along the lines of "A list of ..." or "A pipe-separated list of ...".

Timestamps
Parameters that take timestamp values accept multiple timestamp formats: In the output, timestamps are always in ISO 8601 format.
 * ISO 8601 format:
 * MediaWiki's internal timestamp format:
 * MySQL's internal timestamp format
 * UNIX timestamp format (number of seconds since January 1, 1970)

Output
MediaWiki API supports a number of generic output formats (XML,JSON,YAML,...), and some domain specific formats (RSS, ...) for special modules.

Unless specified, all modules allow data output in all generic formats. To simplify debugging, all generic formats have "pretty-print in HTML" alternatives with 'fm' suffix. By default, xmlfm format is used.

Note that while the pretty-print formats are all indented and separate syntactic elements with newlines, the non-pretty formats don't do this (except for YAML, because indentation is part of its syntax).

JSON callback restrictions
When using JSON in callback mode, a number of things are disabled for security:
 * Tokens cannot be obtained (so state-changing actions aren't possible)
 * The client is treated as an anonymous user (i.e. not logged in) for all purposes, even after logging in through action=login
 * This means that things that require additional rights, such as, won't work unless anonymous users are allowed to use them