API:Parameter information

From MediaWiki.org
Jump to navigation Jump to search

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎català • ‎dansk • ‎español • ‎français • ‎polski • ‎português • ‎română • ‎русский • ‎سنڌي • ‎ไทย • ‎中文 • ‎日本語 • ‎한국어
MediaWiki version: 1.12

GET request to obtain information about other action API modules , and their parameters.

API documentation[edit]


action=paraminfo

(main | paraminfo)

Obtain information about API modules.

Parameters:
modules

List of module names (values of the action and format parameters, or main). Can specify submodules with a +, or all submodules with +*, or all submodules recursively with +**.

Separate values with | or alternative. Maximum number of values is 50 (500 for bots).
helpformat

Format of help strings.

One of the following values: html, wikitext, raw, none
Default: none
querymodules
Deprecated.

List of query module names (value of prop, meta or list parameter). Use modules=query+foo instead of querymodules=foo.

Values (separate with | or alternative): abusefilters, abuselog, allcategories, alldeletedrevisions, allfileusages, allimages, alllinks, allmessages, allpages, allredirects, allrevisions, alltransclusions, allusers, authmanagerinfo, babel, backlinks, betafeatures, blocks, categories, categoryinfo, categorymembers, centralnoticeactivecampaigns, centralnoticelogs, checkuser, checkuserlog, cirrusbuilddoc, cirrusdoc, codecomments, codepaths, coderevisions, codetags, contributors, deletedrevisions, deletedrevs, description, duplicatefiles, embeddedin, extdistbranches, extdistrepos, extlinks, extracts, exturlusage, featureusage, filearchive, filerepoinfo, fileusage, flowinfo, gadgetcategories, gadgets, globalallusers, globalblocks, globalgroups, globalpreferences, globalrenamestatus, globalusage, globaluserinfo, imageinfo, images, imageusage, info, iwbacklinks, iwlinks, langbacklinks, langlinks, languageinfo, languagestats, links, linkshere, linterrors, linterstats, logevents, mapdata, messagecollection, messagegroups, messagegroupstats, messagetranslations, mmsites, mostviewed, mystashedfiles, notifications, oath, pageimages, pagepropnames, pageprops, pageswithprop, pageterms, pageviews, prefixsearch, protectedtitles, querypage, random, readinglistentries, readinglists, recentchanges, redirects, references, revisions, search, siteinfo, siteviews, stashimageinfo, tags, templates, threads, tokens, transcludedin, transcodestatus, unreadnotificationpages, usercontribs, userinfo, users, videoinfo, watchlist, watchlistraw, wbentityusage, wblistentityusage, wikibase, wikisets
Maximum number of values is 50 (500 for bots).
mainmodule
Deprecated.

Get information about the main (top-level) module as well. Use modules=main instead.

pagesetmodule
Deprecated.

Get information about the pageset module (providing titles= and friends) as well.

formatmodules
Deprecated.

List of format module names (value of format parameter). Use modules instead.

Values (separate with | or alternative): json, jsonfm, none, php, phpfm, rawfm, xml, xmlfm

Example[edit]

GET request[edit]

Getting information about action=parse , prop=info , and a bogus query module:

Response[edit]

{
    "warnings": {
        "paraminfo": {
            "*": "The module \"query\" does not have a submodule \"blah\"."
        }
    },
    "paraminfo": {
        "helpformat": "none",
        "modules": [
            {
                "name": "parse",
                "classname": "ApiParse",
                "path": "parse",
                ...
            },
            {
                "name": "info",
                "classname": "ApiQueryInfo",
                "path": "query+info",
                ...
            }
        ]
    }
}

Sample code[edit]

paraminfo.py

#!/usr/bin/python3

"""
    paraminfo.py

    MediaWiki Action API Code Samples
    Demo of "Paraminfo" module: Obtain information about the 
    modules API:Parse, API:Info, and one nonexistent module.
    MIT license
"""

import requests

S = requests.Session()

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

PARAMS = {
    "action":"paraminfo",
    "format":"json",
    "modules": "parse|query+info|query+blah"
}

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

print(DATA)

Parameter history[edit]

  • v1.25:
    • Deprecated querymodules, mainmodule, pagesetmodule, formattmodule
    • Introduced helpformat
  • v1.19: Introduced formatmodules
  • v1.15: Introduced pagesetmodule, mainmodule

See also[edit]