API
MediaWiki拥有多种应用程序接口(API)。
其中,最重要的三种MediaWiki API是:
- the MediaWiki Action API (api.php), which is a web API that lets you read and write content of a MediaWiki wiki
- the MediaWiki PHP API, which can be used to develop extensions for MediaWiki in PHP
- the MediaWiki JavaScript API (mw), which can be used to develop user scripts and gadgets to extend the MediaWiki user interface
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:客户端代码 .
其他web API
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 |
参见
Suggestions and ideas for the MediaWiki APIs are tracked on Phabricator :
- Phabricator tasks for the MediaWiki-Action-API
- Phabricator tasks for the MediaWiki-Core-Hooks that are part of the PHP API
- Phabricator tasks related to JavaScript in MediaWiki core or extensions
- Phabricator tasks for the MediaWiki-REST-API