API:Parameterinformation
Appearance
This page is part of the MediaWiki Action API documentation. |
MediaWiki Version: | ≥ 1.12 |
GET request to obtain information about other action API modules , and their parameters.
API-Dokumentation
Beispiel
GET-Anfrage
Erhalte Informationen über
action=parse
, prop=info
und ein Schein-Abfragemodul:
Antwort
{
"warnings": {
"paraminfo": {
"*": "The module \"query\" does not have a submodule \"blah\"."
}
},
"paraminfo": {
"helpformat": "none",
"modules": [
{
"name": "parse",
"classname": "ApiParse",
"path": "parse",
...
},
{
"name": "info",
"classname": "ApiQueryInfo",
"path": "query+info",
...
}
]
}
}
Beispielcode
Python
#!/usr/bin/python3
"""
paraminfo.py
MediaWiki API Demos
Demo of `Paraminfo` module: Obtain information about other modules.
MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
"action": "paraminfo",
"format": "json",
"modules": "parse|query+info|query"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print(DATA)
PHP
<?php
/*
paraminfo.php
MediaWiki API Demos
Demo of `Paraminfo` module: Get information about other action API modules and their parameters.
MIT License
*/
$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
"action" => "paraminfo",
"format" => "json",
"modules" => "parse|query+info|query"
];
$url = $endPoint . "?" . http_build_query( $params );
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
curl_close( $ch );
$result = json_decode( $output, true );
var_dump( $result );
JavaScript
/*
paraminfo.js
MediaWiki API Demos
Demo of `Paraminfo` module: Get information about other action API modules and their parameters.
MIT License
*/
var url = "https://en.wikipedia.org/w/api.php";
var params = {
action: "paraminfo",
format: "json",
modules: "parse|query+info|query"
};
url = url + "?origin=*";
Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];});
fetch(url)
.then(function(response){return response.json();})
.then(function(response) {console.log(response);})
.catch(function(error){console.log(error);});
MediaWiki JS
/*
paraminfo.js
MediaWiki API Demos
Demo of `Paraminfo` module: Get information about other action API modules and their parameters.
MIT License
*/
var params = {
action: 'paraminfo',
format: 'json',
modules: 'parse|query+info|query'
},
api = new mw.Api();
api.get( params ).done( function ( data ) {
console.log( data );
} );
Parametergeschichte
- v1.25:
- Veralteter
querymodules
,mainmodule
,pagesetmodule
,formatmodule
Whilepagesetmodule
is not available distinctly through themodules
parameter, its parameters are rolled into the modules to which it applies. Zum Beispiel gibtmodules=purge
titles
,pageids
usw. zurück. - Eingeführt
helpformat
- Veralteter
- v1.19: Eingeführt
formatmodules
- v1.15: Eingeführt
pagesetmodule
,mainmodule
Siehe auch
- API:Info - retrieves information about pages.
- API:User - retrieves information about users.
- API:Imageinfo - retrieves information about images.