API:מידע פרמטר

This page is a translated version of the page API:Parameter information and the translation is 95% complete.
MediaWiki version:
1.12

בקשת GET לקבלת מידע על מודולי action API אחרים והפרמטרים שלהם.

תיעוד API

action=paraminfo

(main | paraminfo)

Obtain information about API modules.

Specific parameters:
Other general parameters are available.
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 clients that are allowed higher limits).
helpformat

Format of help strings.

One of the following values: html, none, raw, wikitext
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, cirruscompsuggestbuilddoc, cirrusdoc, 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, managemessagegroups, mapdata, messagecollection, messagegroups, messagegroupstats, messagegroupsubscription, messagetranslations, mmcontent, mostviewed, mystashedfiles, notifications, oath, pageimages, pagepropnames, pageprops, pageswithprop, pageterms, pageviews, prefixsearch, protectedtitles, querypage, random, readinglistentries, readinglists, recentchanges, redirects, 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 clients that are allowed higher limits).
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


דוגמה

בקשת GET

קבלת מידע על action=parse ,‏ prop=info ומודול שאילתא מזויף:

תשובה

{
    "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",
                ...
            }
        ]
    }
}

קוד לדוגמה

Python

#!/usr/bin/python3

"""
    paraminfo.py

    MediaWiki API Demos
    Demo of `Paraminfo` module: Obtain information about other modules.

    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"
}

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

print(DATA)

PHP

<?php
/*
    paraminfo.php

    MediaWiki API Demos
    Demo of `Paraminfo` module: Get information about other action API modules and their parameters.

    MIT License
*/

$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
    "action" => "paraminfo",
    "format" => "json",
    "modules" => "parse|query+info|query"
];

$url = $endPoint . "?" . http_build_query( $params );

$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
curl_close( $ch );

$result = json_decode( $output, true );
var_dump( $result );

JavaScript

/*
    paraminfo.js

    MediaWiki API Demos
    Demo of `Paraminfo` module: Get information about other action API modules and their parameters.

    MIT License
*/

var url = "https://en.wikipedia.org/w/api.php"; 

var params = {
    action: "paraminfo",
    format: "json",
    modules: "parse|query+info|query"
};

url = url + "?origin=*";
Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];});

fetch(url)
    .then(function(response){return response.json();})
    .then(function(response) {console.log(response);})
    .catch(function(error){console.log(error);});

MediaWiki JS

/*
	paraminfo.js

	MediaWiki API Demos
	Demo of `Paraminfo` module: Get information about other action API modules and their parameters.

	MIT License
*/

var params = {
		action: 'paraminfo',
		format: 'json',
		modules: 'parse|query+info|query'
	},
	api = new mw.Api();

api.get( params ).done( function ( data ) {
	console.log( data );
} );

היסטוריית פרמטרים

  • v1.25:
    • querymodules, mainmodule, pagesetmodule, formatmodule התיישן
      While pagesetmodule is not available distinctly through the modules parameter, its parameters are rolled into the modules to which it applies. לדוגמה, modules=purge יחזיר titles,‏ pageids וכו'.
    • helpformat הוצג
  • v1.19: formatmodules הוצג
  • v1.15: pagesetmodule, mainmodule הוצג

ר׳ גם

  • API:Info - מאחזר מידע אודות דפים.
  • API:User - מאחזר מידע אודות משתמשים.
  • API:Imageinfo - מאחזר מידע אודות תמונות.