Jump to content

API:Documentation template: Difference between revisions

From mediawiki.org
Content deleted Content added
No edit summary
No edit summary
Line 1: Line 1:
{{Toclimit|limit=3}}{{Page in progress}}{{API}}
{{Page in progress}}{{API}}
== Overview ==
== Overview ==
'''<big><span style="color: #00693E" class="">(TYPE OF REQUEST) Request</span> </big>'''<big>to (purpose of the API). </big>
'''<big><span style="color: #00693E" class="">(TYPE OF REQUEST) Request</span> </big>'''<big>to (purpose of the API). </big>

Revision as of 02:03, 1 September 2018

Overview

(TYPE OF REQUEST) Request to (purpose of the API).

API documentation

To embed the documentation of an API module, use the template below. Remember to replace "module name" with the name of an actual module. All main modules are here.

Example

GET Request

Response

{
    "batchcomplete":""
}

Sample code

hello.py

#!/usr/bin/python3

"""
    hello.py

    MediaWiki Action API Code Samples
    Demo of `...` module
    MIT license
"""

import requests

S = requests.Session()

URL = "https://en.wikipedia.org/w/api.php"

PARAMS = {
    'action':"query",
    'format':"json"
}

R = S.get(url=URL, params=PARAMS)
DATA = R.json()

print(DATA)

Demo app(s)

  • Add a link to the demo app. Embed an image of the demo if applicable

Possible errors

Code Info

Additional notes

See also

  • Add link to documentation of related modules