API: Difference between revisions
links to WikiApiary |
|||
| (5 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
Commentary and examples of using the | Commentary and examples of using the APIs (Application Programming Interface) for software like [http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API CiviCRM], [[MediaWiki]], Drupal and web services. Both API documentation and API tools. OS and Internet API references. | ||
[[wp:ApplicationProgrammingInterface|Application Programming Interface]] ([[wp:API|API]]) is the information about the exposed or 'public' variables, methods and objects or classes that a system makes available to the developer who wishes to interface with the system programmatically. If you make an API, documenting the API is a critical software development function. In documentation terms, the API must almost be treated like a separate piece of software within or "attached" to the main program. | [[wp:ApplicationProgrammingInterface|Application Programming Interface]] ([[wp:API|API]]) is the information about the exposed or 'public' variables, methods and objects or classes that a system makes available to the developer who wishes to interface with the system programmatically. If you make an API, documenting the API is a critical software development function. In documentation terms, the API must almost be treated like a separate piece of software within or "attached" to the main program. | ||
| Line 13: | Line 13: | ||
== MediaWiki API == | == MediaWiki API == | ||
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/ | 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!) | |||
Similarly, there is a [[wp:Module:Sandbox|Module:Sandbox]] for testing Lua scripts | |||
===Example Questions === | |||
Here are some example requests to the API | |||
# 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://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 == | |||
Among other tools, you're going to need to look at HTTP requests and responses to develop web services using APIs. So, check out tools like [[Wireshark]] (https://www.wireshark.org/), the [https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor Network Monitor]<ref>The "Live HTTP Headers" add-on still exists, but that is no longer neccessary given the development of the core features of the in-browser developer tools</ref> in [https://developer.mozilla.org/en-US/docs/Tools Developer Tools] for [[Firefox]], or [https://developer.chrome.com/devtools Chrome Developer Tools] | |||
== Integrators == | |||
Companies like [https://platform.ifttt.com/docs IFTTT] (If This Then That) and [https://www.crunchbase.com/organization/zapier#/entity Zapier] offer API integrations so that you can tie together applications via their APIs without any coding. | |||
{{References}} | |||
[[Category:Applications]] | [[Category:Applications]] | ||