API:Data formats/zh

输入
API是通过询问字符串以提供该参数，或者是以 或 形式进行的HTTP请求. 每个模块（以及每个$query的子模块）都会有自己一组的参数，它们都列于文档中以及action=help的模块内. 它们也可以通过为重新检索.

编码
所有输入在UTF-8，以及NFC的表格里应当是有效的. MediaWiki将会尝试转换为其他的格式，这或许会导致程序上的错误.

多值参数
Parameters that take multiple values are normally submitted with the values separated using the pipe character, e.g.. If a value contains the pipe character in itself, use U+001F (Unit Separator) as the separator and prefix the value with U+001F, e.g..

Whether a parameter accepts multiple values is listed explicitly in its module documentation.

布尔参数
If a boolean parameter is specified in an HTTP request, it is considered true regardless of its value. For a false value, omit the parameter entirely. The best way to specify a true parameter in an HTTP request is to use ; the trailing   ensures the browser or HTTP library does not discard the "empty" someParam.

时间戳
Parameters that take timestamp values accept multiple timestamp formats:


 * ISO 8601格式:.
 * MySQL的内部时间戳格式:.
 * UNIX时间戳格式  (自1970年1月1日以来的秒数).
 * UNIX时间戳格式  (自1970年1月1日以来的秒数).

时间戳总是输出ISO 8601格式.

输出
The standard and default output format in MediaWiki is JSON. All other formats are discouraged.

The output format should always be specified using  with yourformat being one of the following:

Response
Unless specified, all modules allow data output in all generic formats. To simplify debugging, all generic formats have "pretty-print in HTML" alternatives with an  suffix, e.g..

JSON参数
The following parameters can be used with  and  :



Additional notes

 * XML and PHP output formats are deprecated but still in use. Clients written in PHP should avoid using the PHP format because it is fundamentally insecure. It is maintained for now only due to its popularity.
 * There are many conversion libraries and online converters to convert JSON responses to other formats—for example, JSON-CSV converts to Comma-Separated Values.
 * Feed modules like Feed Recent Changes override the standard output format, instead using RSS or Atom, as specified by their  parameter. In those cases, the format specified in the   parameter is only used if there's an error.