API:Rsd/pl
Ta strona jest częścią dokumentacji API akcji MediaWiki. |
Wersja MediaWiki: | ≥ 1.23 |
GET request to export an RSD schema.
Dokumentacja API
Przykład
Żądanie GET
GET request to export the RSD schema.
Odpowiedź
<?xml version="1.0"?>
<rsd version="1.0"
xmlns="http://archipelago.phrasewise.com/rsd">
<service>
<apis>
<api name="MediaWiki" preferred="true" apiLink="https://www.mediawiki.org/w/api.php" blogID="">
<settings>
<docs xml:space="preserve">https://www.mediawiki.org/wiki/API</docs>
<setting name="OAuth" xml:space="preserve">false</setting>
</settings>
</api>
</apis>
<engineName xml:space="preserve">MediaWiki</engineName>
<engineLink xml:space="preserve">https://www.mediawiki.org/</engineLink>
<homePageLink xml:space="preserve">https://www.mediawiki.org/wiki/MediaWiki</homePageLink>
</service>
</rsd>
Przykładowy kod
Python
#!/usr/bin/python3
"""
rsd.py
MediaWiki API Demos
Demo of `Rsd` module: Get request to export an RSD schema.
MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
"action": "rsd",
"format": "json"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print(DATA)
PHP
<?php
/*
rsd.php
MediaWiki API Demos
Demo of `Rsd` module: Get request to export an RSD schema.
MIT License
*/
$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
"action" => "rsd",
"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
/*
rsd.js
MediaWiki API Demos
Demo of `Rsd` module: Get request to export an RSD schema.
MIT License
*/
var url = "https://en.wikipedia.org/w/api.php";
var params = {
action: "rsd",
format: "json"
};
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
/*
rsd.js
MediaWiki API Demos
Demo of `Rsd` module: Get request to export an RSD schema.
MIT License
*/
var params = {
action: 'rsd',
format: 'json'
},
api = new mw.Api();
api.get( params ).done( function ( data ) {
console.log( data );
} );
Możliwe błędy
Kod | Info |
---|---|
readapidenied | You need read permission to use this module |
Dodatkowe informacje
- Ten moduł nie może zostać użyty jako generator.
Zobacz też
- API:Edit - allows you to create and edit pages.