Jump to content
MediaWiki

API:Hilfe

From mediawiki.org
This page is a translated version of the page API:Help and the translation is 95% complete.
Outdated translations are marked like this.
Diese Seite ist Teil der Dokumentation der MediaWiki action API.
MediaWiki Action API
Grundlagen
Authentifizierung
Benutzerkonten und Benutzer
Seitenoperationen
Suche
Entwicklerwerkzeuge
Tutorials
v · d · e
MediaWiki Version:
≥ 1.8

GET-Abfrage um Hilfe für bestimmte Module anzuzeigen.

API-Dokumentation

Die folgende Dokumentation ist die Ausgabe von Special:ApiHelp/help, die automatisch von der vorveröffentlichten MediaWiki-Version generiert wird, die auf dieser Seite (MediaWiki.org) läuft.

action=help

(main | help)

Display help for the specified modules.

Specific parameters:
Other general parameters are available.
modules

Modules to display help for (values of the action and format parameters, or main). Can specify submodules with a +.

Separate values with | or alternative.
Maximum number of values is 50 (500 for clients that are allowed higher limits).
Default: main
submodules

Include help for submodules of the named module.

Type: boolean (details)
recursivesubmodules

Include help for submodules recursively.

Type: boolean (details)
wrap

Wrap the output in a standard API response structure.

Type: boolean (details)
toc

Include a table of contents in the HTML output.

Type: boolean (details)


Beispiel

GET-Anfrage

Hilfe für das angegebene Modul erhalten.

Antwort

{
"help":{
"mime":"text/html",
"filename":"api-help.html",
"help":"<!DOCTYPE html>\n<html class=\"client-nojs\" lang=\"en\" dir=\"ltr\">\n<head>\n<meta charset=\"UTF-8\"/>\n<title>MediaWiki API help - Wikipedia</title>\n<script>document.documentElement.className=\"client-js\";RLCONF={\"wgBreakFrames\":!0,\"wgSeparatorTransformTable\":[\"\",\"\"],\"wgDigitTransformTable\":[\"\",\"\"],\"wgDefaultDateFormat\":\"dmy\",\"wgMonthNames\":
...
 }
}

Beispielcode

Python

#!/usr/bin/python3
"""
 get_help.py
 MediaWiki API Demos
 Demo of `Help` module: Get help for a specified module.
 MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
 "action": "help",
 "modules": "query+tokens",
 "wrap": "",
 "format": "json"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print(DATA)

PHP

<?php
/*
 get_help.php
 MediaWiki API Demos
 Demo of `Help` module: Get help for a specified module.
 MIT License
*/
$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
 "action" => "help",
 "modules" => "query+tokens",
 "wrap" => "",
 "format" => "json"
];
$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

/*
 get_help.js
 MediaWiki API Demos
 Demo of `Help` module: Get help for a specified module.
 MIT License
*/
varurl="https://en.wikipedia.org/w/api.php";
varparams={
action:"help",
modules:"query+tokens",
wrap:"",
format:"json"
};
url=url+"?origin=*";
Object.keys(params).forEach(function(key){url+="&"+key+"="+params[key];});
fetch(url)
.then(function(response){returnresponse.json();})
.then(function(response){console.log(response);})
.catch(function(error){console.log(error);});

MediaWiki JS

/*
	get_help.js
	MediaWiki API Demos
	Demo of `Help` module: Get help for a specified module.
	MIT License
*/
varparams={
action:'help',
modules:'query+tokens',
wrap:'',
format:'json'
},
api=newmw.Api();
api.get(params).done(function(data){
console.log(data);
});

Mögliche Fehler

Code Information
badmodule Das Modul name hat kein Untermodul namens „name2".

Parametergeschichte

  • v1.25: Eingeführt submodules, recursivesubmodules, wrap, toc
  • v1.25: querymodules entfernt
  • v1.21: Veralteter querymodules
  • v1.17: Eingeführt action, format, main

Siehe auch

  • API:Hauptseite - bietet einen Überblick der MediaWiki action API.
  • API:FAQ - bietet Antworten zu häufig gestellten Fragen über die MediaWiki Action API.

AltStyle によって変換されたページ (->オリジナル) /