API:Lists
Language: | English • Deutsch • español • 日本語 • polski • українська • 中文 |
---|
This page is part of the MediaWiki action API documentation. |
MediaWiki action API
- Introduction and quick start
- FAQ
- Tutorial
- Formats
- Error reporting
- Restricting usage
- Cross-site requests
- Authentication
- Queries
- Searching (by title, content, coordinates...)
- Parsing wikitext and expanding templates
- Purging pages' caches
- Parameter information
- Changing wiki content
- Create and edit pages
- Move pages
- Merge pages
- Rollback
- Delete pages
- Restore deleted revisions
- (Un)protect pages
- (Un)block users
- (Un)watch pages
- Mark revisions of watched pages as visited
- Send email
- Patrol changes
- Import pages
- Change user group membership
- Upload files
- User options
- Tokens
- Page language
- Watchlist feed
- Wikidata
- Extensions
- Using the API in MediaWiki and extensions
- Miscellaneous
- Implementation
- Client code
- Asserting
Lists differ from properties in two aspects - instead of appending data to the elements in the pages
element, each list has its own separated branch in the query
element. Also, list output is limited by number of items, and may be continued using the query-continue
element. Unless indicated otherwise, modules listed on this page can be used as generators.
Submodules[edit]
- Browse all in a single page
- allcategories
- alldeletedrevisions
- allfileusages
- allimages
- alllinks
- allpages
- allredirects
- allrevisions
- alltransclusions
- allusers
- backlinks
- blocks
- categorymembers
- deletedrevs
- embeddedin
- exturlusage
- filearchive
- imageusage
- iwbacklinks
- langbacklinks
- logevents
- pagepropnames
- pageswithprop
- prefixsearch
- protectedtitles
- querypage
- random
- recentchanges
- search
- tags
- usercontribs
- users
- watchlist
- watchlistraw
Limits[edit]
All list queries return a limited number of results. This limit is 10 by default, and can be set as high as 500 for regular users, or 5000 for users with the apihighlimits
right (typically bots and sysops). The limit parameter for a given module consists of the module prefix followed by limit
, so ptlimit
is the maximum number of protectedtitles
returned, and cmlimit
is the maximum number of categorymembers
returned. Some modules impose stricter limits under certain conditions. If you're not sure which limit applies to you and just want as many results as possible, set the limit to max
. In that case, a <limits>
element will be returned, specifying the limits used.
Errors
If you set the limit to a value higher than the maximum, an error will be thrown, which looks like:
Code | Info |
---|---|
aplimit | aplimit may not be over 500 (set to 1000) for users |
(ap
can be replaced with any other module prefix; the ap
prefix corresponds to the list=allpages
parameter)
Example[edit]
Getting the maximum amount of revisions with content and backlinks for en:Winnipeg, Manitoba
Result |
---|
<?xml version="1.0" encoding="utf-8"?>
<api>
<query>
<pages>
<page pageid="6842860" ns="0" title="Winnipeg, Manitoba">
<revisions>
<rev>#REDIRECT [[Winnipeg]]
{{R from Canadian settlement name}}</rev>
<rev>#REDIRECT [[Winnipeg]]</rev>
</revisions>
</page>
</pages>
<backlinks>
<bl pageid="924" ns="0" title="A. A. Milne" />
<bl pageid="5959" ns="0" title="Canadian Pacific Railway" />
<!-- ... -->
<bl pageid="708754" ns="2" title="User:ChrisErbach" />
<bl pageid="802133" ns="2" title="User:Earl Andrew/54nl) 80X" />
</backlinks>
</query>
<limits revisions="50" backlinks="500" />
<query-continue>
<backlinks blcontinue="0|Winnipeg,_Manitoba|994168" />
</query-continue>
</api>
|