API: Difference between revisions
No edit summary |
|||
| (One intermediate revision by one other user not shown) | |||
| Line 13: | Line 13: | ||
== MediaWiki API == | == MediaWiki API == | ||
MediaWiki has a strong '''action''' API (also called the web service API) which has it's endpoint at api.php. See the docs at https://www.mediawiki.org/wiki/API:Main_page | |||
Since MW 1.27, there is also a SpecialPage [[mw:Special:ApiSandbox|Special:ApiSandbox]] [https://demo.qualitybox.us/wiki/Special:ApiSandbox Demo site] for interacting with the API - just like the API explorer for CiviCRM. (previously it was an extension) | |||
An example of the MediaWiki API in use is at the "[https://freephile.org/wikireport/index.php Wiki Report]" project. Another very interesting example is the [https://wikiapiary.com/wiki/Freephile_Wiki Wiki Apiary] (clever name!) | An example of the MediaWiki API in use is at the "[https://freephile.org/wikireport/index.php Wiki Report]" project. Another very interesting example is the [https://wikiapiary.com/wiki/Freephile_Wiki Wiki Apiary] (clever name!) | ||
Similarly, there is a [[wp:Module:Sandbox|Module:Sandbox]] for testing Lua scripts | |||
===Example Questions === | ===Example Questions === | ||
Here are some example requests to the API | Here are some example requests to the API | ||
# https://freephile.org/ | # https://wiki.freephile.org/wiki/api.php?action=query&meta=siteinfo&siprop=extensions With no 'format' argument, you will get a "pretty" HTML output that you can read in your browser. | ||
# https://freephile.org/ | # https://wiki.freephile.org/wiki/api.php?action=query&meta=siteinfo&siprop=extensions&format=json With *json* explicitly requested as the format, you can get values suitable for actual programming. | ||
See [[Categories/javascript]] for an example using the internal JavaScript API '''mw.Api''' | |||
== Developer Tools == | == Developer Tools == | ||