API: Difference between revisions

From mediawiki.org
Content deleted Content added
adding < translate > sections
Marked this version for translation
Line 8: Line 8:
</translate>
</translate>


* <translate>the [[<tvar name=1>Special:MyLanguage/API:Main_page</tvar>|MediaWiki Action API]] (''api.php''), which is a web API that lets you read and write content of a <tvar name=2>{{ll|MediaWiki wiki}}</tvar></translate>
* <translate><!--T:6--> the [[<tvar name=1>Special:MyLanguage/API:Main_page</tvar>|MediaWiki Action API]] (''api.php''), which is a web API that lets you read and write content of a <tvar name=2>{{ll|MediaWiki wiki}}</tvar></translate>
* <translate>the [<tvar name=1>https://doc.wikimedia.org/mediawiki-core/master/php/</tvar> MediaWiki PHP API], which can be used to develop <tvar name=2>{{ll|extensions}}</tvar> for MediaWiki in <tvar name=3>{{ll|PHP}}</tvar></translate>
* <translate><!--T:7--> the [<tvar name=1>https://doc.wikimedia.org/mediawiki-core/master/php/</tvar> MediaWiki PHP API], which can be used to develop <tvar name=2>{{ll|extensions}}</tvar> for MediaWiki in <tvar name=3>{{ll|PHP}}</tvar></translate>
* <translate>the [<tvar name=url>https://doc.wikimedia.org/mediawiki-core/master/js/</tvar> MediaWiki JavaScript API] (''mw''), which can be used to develop</translate> {{ll|user scripts|<translate>user scripts and gadgets</translate>}} <translate>to extend the MediaWiki user interface</translate>
* <translate><!--T:8--> the [<tvar name=url>https://doc.wikimedia.org/mediawiki-core/master/js/</tvar> MediaWiki JavaScript API] (''mw''), which can be used to develop</translate> {{ll|user scripts|<translate><!--T:9--> user scripts and gadgets</translate>}} <translate><!--T:10--> to extend the MediaWiki user interface</translate>


<translate>Note that the MediaWiki Action API and the MediaWiki JavaScript API are both modular: both can be extended by extensions, so the available API modules can differ from wiki to wiki.</translate><ref><translate>For extending the Action API, see <tvar name=1>{{ll|API:Extensions}}</tvar>.</translate> <translate>For information about JavaScript modules, see <tvar name=1>{{ll|ResourceLoader}}</tvar>.</translate>
<translate><!--T:11--> Note that the MediaWiki Action API and the MediaWiki JavaScript API are both modular: both can be extended by extensions, so the available API modules can differ from wiki to wiki.</translate><ref><translate><!--T:12--> For extending the Action API, see <tvar name=1>{{ll|API:Extensions}}</tvar>.</translate> <translate><!--T:13--> For information about JavaScript modules, see <tvar name=1>{{ll|ResourceLoader}}</tvar>.</translate>
</ref>
</ref>
<translate>While the API modules built into <tvar name=1>{{ll|MediaWiki Core}}</tvar> are available in most MediaWiki wikis, built-in Action API modules</translate> {{ll|API:Restricting API usage|<translate>can also be disabled</translate>}}.
<translate><!--T:14--> While the API modules built into <tvar name=1>{{ll|MediaWiki Core}}</tvar> are available in most MediaWiki wikis, built-in Action API modules</translate> {{ll|API:Restricting API usage|<translate><!--T:15--> can also be disabled</translate>}}.


<translate>Within the context of the MediaWiki website the Action API can be accessed from JavaScript via the [<tvar name=1>https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Api</tvar> mw.API] JavaScript API.</translate>
<translate><!--T:16--> Within the context of the MediaWiki website the Action API can be accessed from JavaScript via the [<tvar name=1>https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Api</tvar> mw.API] JavaScript API.</translate>
<translate>For libraries to access the MediaWiki Action API from your favorite programming language, see <tvar name=1>{{ll|API:Client code}}</tvar>.</translate>
<translate><!--T:17--> For libraries to access the MediaWiki Action API from your favorite programming language, see <tvar name=1>{{ll|API:Client code}}</tvar>.</translate>


<translate>
<translate>
Line 28: Line 28:
== See also == <!--T:4-->
== See also == <!--T:4-->
</translate>
</translate>
<translate>Suggestions and ideas for the MediaWiki APIs are tracked on <tvar name=1>{{ll|Phabricator}}</tvar>:</translate>
<translate><!--T:18--> Suggestions and ideas for the MediaWiki APIs are tracked on <tvar name=1>{{ll|Phabricator}}</tvar>:</translate>


* [[phab:tag/MediaWiki-Action-API|<translate>Phabricator tasks for the MediaWiki-Action-API</translate>]]
* [[phab:tag/MediaWiki-Action-API|<translate><!--T:19--> Phabricator tasks for the MediaWiki-Action-API</translate>]]
* <translate>[[<tvar name=1>phab:tag/MediaWiki-Core-Hooks</tvar>|Phabricator tasks for the MediaWiki-Core-Hooks]] that are part of the PHP API</translate>
* <translate><!--T:20--> [[<tvar name=1>phab:tag/MediaWiki-Core-Hooks</tvar>|Phabricator tasks for the MediaWiki-Core-Hooks]] that are part of the PHP API</translate>
* <translate>[[<tvar name=1>phab:tag/javascript</tvar>|Phabricator tasks related to JavaScript]] in MediaWiki core or extensions</translate>
* <translate><!--T:21--> [[<tvar name=1>phab:tag/javascript</tvar>|Phabricator tasks related to JavaScript]] in MediaWiki core or extensions</translate>
* [[phab:tag/MediaWiki-REST-API|<translate>Phabricator tasks for the MediaWiki-REST-API</translate>]]
* [[phab:tag/MediaWiki-REST-API|<translate><!--T:22--> Phabricator tasks for the MediaWiki-REST-API</translate>]]


<translate>
<translate>

Revision as of 13:46, 29 March 2023

MediaWiki has several application programming interfaces (APIs).

The three most important APIs of MediaWiki probably are:

Note that the MediaWiki Action API and the MediaWiki JavaScript API are both modular: both can be extended by extensions, so the available API modules can differ from wiki to wiki.[1] While the API modules built into MediaWiki Core are available in most MediaWiki wikis, built-in Action API modules can also be disabled .

Within the context of the MediaWiki website the Action API can be accessed from JavaScript via the mw.API JavaScript API. For libraries to access the MediaWiki Action API from your favorite programming language, see API:Client code .

Other web APIs

This table: view · talk · edit
API Availability URL base Example
MediaWiki Action API Included with MediaWiki

Enabled on Wikimedia projects

/api.php https://en.wikipedia.org/w/api.php?action=query&prop=info&titles=Earth
MediaWiki REST API Included with MediaWiki 1.35+

Enabled on Wikimedia projects

/rest.php https://en.wikipedia.org/w/rest.php/v1/page/Earth
Wikimedia REST API Not included with MediaWiki

Available for Wikimedia projects only

/api/rest https://en.wikipedia.org/api/rest_v1/page/title/Earth
For commercial-scale APIs for Wikimedia projects, see Wikimedia Enterprise

See also

Suggestions and ideas for the MediaWiki APIs are tracked on Phabricator :

Footnotes

  1. For extending the Action API, see API:Extensions . For information about JavaScript modules, see ResourceLoader .