Jump to content
MediaWiki

API:Rsd

From mediawiki.org
This page is a translated version of the page API:Rsd and the translation is 73% complete.
This page is part of the MediaWiki Action API documentation.
MediaWiki Action API
พื้นฐาน
การอนุมัติ
บัญชีและผู้ใช้
Page Operations
ค้นหา
Developer Utilities
Tutorials
v · d · e
เวอร์ชันมีเดียวิกิ:
≥ 1.23

GET request to export an RSD schema.

API documentation

The following documentation is the output of Special:ApiHelp/rsd, automatically generated by the pre-release version of MediaWiki that is running on this site (MediaWiki.org).

action=rsd

(main | rsd)

Export an RSD (Really Simple Discovery) schema.

Example:
Export the RSD schema.
api.php?action=rsd [open in sandbox]

ตัวอย่าง

GET request

GET request to export the RSD schema.

Response

<?xml version="1.0"?>
<rsdversion="1.0"
xmlns="http://archipelago.phrasewise.com/rsd">
<service>
<apis>
<apiname="MediaWiki"preferred="true"apiLink="https://www.mediawiki.org/w/api.php"blogID="">
<settings>
<docsxml:space="preserve">https://www.mediawiki.org/wiki/API</docs>
<settingname="OAuth"xml:space="preserve">false</setting>
</settings>
</api>
</apis>
<engineNamexml:space="preserve">MediaWiki</engineName>
<engineLinkxml:space="preserve">https://www.mediawiki.org/</engineLink>
<homePageLinkxml:space="preserve">https://www.mediawiki.org/wiki/MediaWiki</homePageLink>
</service>
</rsd>

รหัสตัวอย่าง

Python

#!/usr/bin/python3
"""
 rsd.py
 MediaWiki API Demos
 Demo of `Rsd` module: Get request to export an RSD schema.
 MIT License
"""
importrequests
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
*/
varurl="https://en.wikipedia.org/w/api.php";
varparams={
action:"rsd",
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

/*
	rsd.js
	MediaWiki API Demos
	Demo of `Rsd` module: Get request to export an RSD schema.
	MIT License
*/
varparams={
action:'rsd',
format:'json'
},
api=newmw.Api();
api.get(params).done(function(data){
console.log(data);
});

ข้อบกพร่อง (error) ที่อาจเกิด

รหัส (Code) ข้อมูล (Info)
readapidenied You need read permission to use this module

บันทึกเพิ่มเติม

ดูเพิ่ม

  • API:Edit - allows you to create and edit pages.

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