API:Documentation template

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki version: 1.23

API documentation[edit]

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.




Module "Module_name" not found.

Example[edit]

GET Request[edit]

Description of script

Response[edit]

{
    "batchcomplete":""
}

Sample code[edit]

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)[edit]

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

Possible errors[edit]

Code Info

Parameter history[edit]

  • v1.x: Introduced parameter_1, parameter_2
  • v0.x: Deprecated parameter_3

Additional notes[edit]

See also[edit]

  • Add link to documentation of related modules