API:Properties/zh

通过prop参数选择需要获取页面的哪些属性. prop可以与titles=, pageids=, or revids=等参数连用，或使用生成器.

prop参数的值可以为info（可缩写为in）、 revisions（rv）、categories（cl）、imageinfo（ii）、 langlinks（ll）、links（pl）、 images（im）、templates（tl）、 extlinks（el）、categoryinfo（ci）、duplicatefiles（df）、 pageprops（pp），或以上几项的组合（如in|rv）.

info / in
Retrieves basic page information. The code for retrieving page properties is located on the git repository at.

Info: Parameters

 * : Which properties to get
 * : The protection level
 * : The page ID of the talk page for each non-talk page
 * : The page ID of the parent page for each talk page
 * : The full and edit  for each page
 * : Include the text returned by EditFormPreloadText.
 * : Indicates whether or not the page is being watched by you. (It returns an empty string if you watch the page and the key is missing from answer if you don't watch it.)
 * By default, the following properties will be listed:
 * : page ID.
 * : namespace.
 * : title.
 * : page_touched timestamp.
 * : last revision ID.
 * : If $wgDisableCounters is false, gives number of views. Otherwise, gives empty attribute. (note that $wgDisableCounters is set to true on Wikimedia servers.)
 * : page size.
 * : whether the page is a redirect.
 * : whether the page has only one revision.
 * : Which token to get
 * : Get a token for page edit
 * : Get a token for page move
 * : Get a token for page deletion
 * : When more results are available, use this to continue
 * When the result is bigger than $wgAPIMaxResultSize

Info: Possible warnings

 * Action ' action ' is not allowed for the current user
 * Thrown when a token is requested that the current user isn't allowed to use
 * No support for special pages has been implemented
 * Thrown when a special page is requested

Info: Possible errors
None

revisions / rv
Returns revisions for a given page, or the latest revision for each of several pages. When using parameters marked as (enum),  must have only one title listed. The code for this query is located on the git repository at

Revisions: Parameters

 * : Which properties to get for each revision
 * : Get both of these IDs: revid, parentid (default)
 * : Whether the revision was a minor edit (default)
 * : The date and time the revision was made (default)
 * : The user who made the revision, as well as userhidden and anon flags (default)
 * : User id of revision creator, as well as userhidden and anon flags
 * : SHA-1 (base 16) of the revision
 * : The edit comment (default)
 * : The edit/log comment in HTML format with wikilinks and section references expanded into hyperlinks (. Added in )
 * : The size of the revision text in bytes
 * : The revision content. If set, the maximum limit will be 10 times as low
 * : any tags for this revision, such as those added by AbuseFilter.
 * : When more results are available, use this to continue. This can be used, for example, for fetching the text of all revisions of a page (although an XML export might be more efficient).
 * : The maximum number of revisions to return. Use the string "max" to return all revisions (subject to being broken up as usual, using continue). Limited by query limits defined in ApiBase, which equals 500 for users and 5000 for bots. (enum)
 * : Revision ID to start listing from. (enum)
 * : Revision ID to stop listing at. (enum)
 * : Timestamp to start listing from. (enum)
 * : Timestamp to end listing at. (enum)
 * : Direction to list in. (enum)
 * : List newest revisions first (default) NOTE: rvstart/rvstartid has to be higher than rvend/rvendid
 * : List oldest revisions first NOTE: rvstart/rvstartid has to be lower than rvend/rvendid
 * : Only list revisions made by this user
 * : Do not list revisions made by this user
 * : Expand templates in  output
 * : Generate XML parse tree for revision content
 * : Parse revision content. For performance reasons if this option is used, rvlimit is enforced to 1.
 * : If  is set, only retrieve the contents of this section. This is an integer, not a string title.
 * : Tokens to get for each revision
 * : Rollback token
 * : Revision ID to diff each revision to. Use "prev", "next" and "cur" for the previous, next and current revision respectively.
 * : Text to diff each revision to. Only diffs a limited number of revisions. Overrides diffto. If rvsection is set, only that section will be diffed against this text.

Revisions: Possible warnings

 * Action ' action ' is not allowed for the current user
 * Thrown when a token is requested that the current user isn't allowed to use
 * No support for special pages has been implemented
 * Thrown when a special page is requested

Revisions: Possible errors

 * code: rvrevids
 * info: The revids= parameter may not be used with the list options (limit, startid, endid, dirNewer, start, end).
 * code: rvmultpages
 * info: titles, pageids or a generator was used to supply multiple pages, but the limit, startid, endid, dirNewer, user, excludeuser, start and end parameters may only be used on a single page.
 * code: rvaccessdenied
 * info: The current user is not allowed to read title
 * code: rvbadparams
 * info: start and startid cannot be used together
 * code: rvbadparams
 * info: end and endid cannot be used together
 * code: rvbadparams
 * info: user and excludeuser cannot be used together
 * code: rvnosuchsection
 * info: There is no section section in rrevid

categories / cl
Gets a list of all categories used on the provided pages. This module can be used as a generator.

Parameters

 * : Which properties to get (cannot be used with a generator)
 * : The sort key
 * : The date and time the page was added to the category, or the date and time its sortkey was changed last
 * : Which kinds of categories to list. Conflicting options (such as  and  ) cannot be used together.
 * : Only list hidden categories
 * : Don't list hidden categories
 * : Maximum number of results to return
 * : When more results are available, use this to continue
 * : Only list these categories. Useful to check whether a certain page is in a certain category
 * This parameter takes full titles, so the Category: prefix must be used

Possible warnings

 * ' title ' is not a category
 * The title mentioned is not in the Category: namespace

Possible errors

 * code: clshow
 * info: Incorrect parameter - mutually exclusive values may not be supplied

imageinfo / ii
Gets image information for any titles in the image namespace

Parameters

 * : Which properties to get
 * : The time and date of the revision (default)
 * : The user who made the revision (default)
 * : The edit comment
 * : URL of the image
 * : The image's size in bytes, plus width and height. A page count is also returned if the image is in a format that supports multiple pages.
 * : The image's SHA-1 hash
 * : The image's MIME type
 * : Image metadata, if available. See Manual:File_metadata_handling for information on file metadata handling in MediaWiki
 * : Image metadata from extensions which implement the GetExtendedMetadata hook. Also contains most of, but in a somewhat standardized format.
 * : Archive name (old images only)
 * : How many image revisions to return (1 by default)
 * : Timestamp to start listing from
 * : Timestamp to stop listing at
 * : If  is set, a URL to an image scaled to this width will be returned as well. Old versions of images can't be scaled
 * : Similar to
 * What version of metadata to use. Only affects JPEGs (as of this writing). You usually want this set to latest.
 * What language to fetch extmetadata in. This affects both which translation to fetch, if multiple are available, as well as how things like numbers and various values are formatted.
 * If translations for extmetadata property are available, fetch all of them. The values of the multi-languaged metadata items will be in the multi-language array format. (Which items are multilanguaged might change from image to image.)
 * The thumb parameter string. Allows user to optionally specify other parameters than width and height (like page number for pdfs). Format of the field varies with image format. PDF uses a format like page - px (e.g. page3-140px ). Its generally the part before the filename in the url of a thumbnail.
 * Only show local images.

langlinks / ll
Gets a list of all language links from the provided pages to other languages.

Only returns language links for 50 titles

Parameters

 * llcontinue: When more results are available, use this to continue
 * lllimit: How many links to return. Default: 10. No more than 500 (5000 for bots) allowed.

Possible errors
None

links / pl
Gets a list of all links on the provided pages. This module can be used as a generator.

Parameters

 * : Only list links to pages in these namespaces
 * :    How many links to return.  Default: 10. No more than 500 (5000 for bots) allowed.
 * : When more results are available, use this to continue

Possible errors
None

templates / tl
Gets a list of all pages (typically templates) transcluded in the provided pages. This module can be used as a generator.

Parameters

 * : Only list pages in these namespaces
 * : How many templates to return. Default: 10. No more than 500 (5000 for bots) allowed.
 * : When more results are available, use this to continue
 * : Only list these templates. Useful to check whether a certain template is transcluded in a certain page

Possible errors
None.

images / im
''In Query API interface, this command found pages that embedded the given image. That function has been renamed to imageusage.

Gets a list of all images used on the provided pages. This module can be used as a generator.

Parameters

 * : How many images to return (since MW 1.13 )

Possible errors
None.

extlinks / el
Gets a list of all external links on the provided pages

Parameters

 * : How many links to return. No more than 500 (5000 for bots) allowed. Default: 10.
 * : When more results are available, use this to continue.

Possible errors
None.

categoryinfo / ci
Gets information about categories


 * Note:
 * If the category page exists, but the category has no members, a "categoryinfo" field will not be included in the API response.

Parameters

 * : When more results are available, use this to continue
 * When the result is bigger than $wgAPIMaxResultSize

Possible errors
None

duplicatefiles / df
List duplicates of the given files.

Parameters

 * : How many duplicates to list
 * : When more results are available, use this to continue

Possible errors
None.

pageprops / pp
Get various properties defined in the page content.

Parameters

 * : When more results are available, use this to continue
 * When the result is bigger than $wgAPIMaxResultSize
 * : Page prop to look on the page for. Useful for checking whether a certain page uses a certain page prop.

Possible errors
None.