API:Query - Lists

From MediaWiki.org

Jump to: navigation, search
This page is part of the MediaWiki API documentation.
MediaWiki API


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, all modules listed on this page can be used as a generator.

Contents

[edit] Limits

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). 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.

[edit] Errors

If you set the limit to a value higher than the maximum, an error will be thrown, which looks like:

  • code: aplimit
    • info: aplimit may not be over 500 (set to 1000) for users

(ap can be replaced with any other module prefix)

[edit] Example

Getting the maximum amount of revisions with content and backlinks for

api.php ? action=query & titles=Winnipeg,_Manitoba & prop=revisions & rvlimit=max & rvprop=content & list=backlinks & bltitle=Winnipeg,_Manitoba & bllimit=max

<?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>

[edit] allpages / ap

MediaWiki version: 1.9

Returns a list of pages in a given namespace, ordered by page title.

[edit] Parameters

  • apfrom: Start listing at this title. The title need not exist
  • apprefix: Only list titles that start with this value
  • apnamespace: The namespace to enumerate. You can only enumerate one namespace at a time. By default, the main namespace will be enumerated
  • apfilterredir: How to filter redirects
    • all: List all pages regardless of their redirect flag (default)
    • redirects: Only list redirects
    • nonredirects: Don't list redirects
  • apfilterlanglinks: How to filter based on whether a page has language links
    • all: List all pages regardless of whether they have language links (default)
    • withlanglinks: Only list pages with language links
    • withoutlanglinks: Only list pages without language links
  • apminsize: Only list pages that are at least this many bytes in size
  • apmaxsize: Only list pages that are at most this many bytes in size
  • apprtype: Only list pages that have been protected from this type of action
    • edit: Only list edit-protected pages
    • move: Only list move-protected pages
    • Other wikis may allow for more kinds of protection and will therefore provide more options here
  • apprlevel: Only list pages that have been protected at this level. Cannot be used without apprtype
    • autoconfirmed: Only autoconfirmed users can edit/move/whatever
    • sysop: Only sysops can edit/move/whatever
    • Empty: Everyone can edit/move/whatever
    • Other wikis may allow protection on more levels and will therefore provide more options here
  • aplimit: Maximum amount of pages to list (10 by default)
  • apdir: In which direction to list
    • ascending: List from A to Z (default)
    • descending: List from Z to A

[edit] Example

Show a list of first 5 pages starting from "Kre"

api.php ? action=query & list=allpages & apfrom=Kre & aplimit=5

<api>
  <query-continue>
    <allpages apfrom="Kreatel" />
  </query-continue>
  <query>
    <allpages>
      <p pageid="1756320" ns="0" title="Kre'fey" />
      <p pageid="3361042" ns="0" title="Kreab" />
      <p pageid="288613" ns="0" title="Kreacher" />
      <p pageid="812540" ns="0" title="Kreamer, PA" />
      <p pageid="133750" ns="0" title="Kreamer, Pennsylvania" />
    </allpages>
  </query>
</api>

[edit] Possible errors

  • code: apparams
    • info: Use "gapfilterredir=nonredirects" option instead of "redirects" when using allpages as a generator
  • code: apparams
    • info: prlevel may not be used without prtype

[edit] alllinks / al

MediaWiki version: 1.11

Returns a list of (unique) links to pages in a given namespace starting ordered by link title.

[edit] Parameters

  • alcontinue: Used to continue a previous request
  • alfrom: Start listing at this title. The title need not exist
  • alprefix: Only list links to titles that begin with this value
  • alnamespace: The namespace to enumerate. You can only enumerate one namespace at a time. By default, the main namespace will be enumerated
  • alunique: If set, multiple links to the same title will be listed only once. Cannot be used in generator mode or with alprop=ids
  • allimit: Maximum amount of links to list (10 by default)
  • alprop: Which properties to return
    • ids: Page IDs of the linking pages. Cannot be used together with alunique
    • title: Link titles (default)

[edit] Example

List all links to talk pages whose name starts with Talk:API

api.php ? action=query & list=alllinks & alprefix=API & alnamespace=1 & alprop=ids|title

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <alllinks alcontinue="APILAS|5484123" />
  </query-continue>
  <query>
    <alllinks>
      <l fromid="3633229" ns="1" title="Talk:API" />
      <l fromid="14912955" ns="1" title="Talk:API-Calculus" />
      <l fromid="15131143" ns="1" title="Talk:API5" />
      <l fromid="15165243" ns="1" title="Talk:API5" />
      <l fromid="8327984" ns="1" title="Talk:APIIC Tower" />
      <l fromid="14109257" ns="1" title="Talk:APIIC Tower" />
      <l fromid="14177354" ns="1" title="Talk:APIIC Tower" />
      <l fromid="14180196" ns="1" title="Talk:APIIC Tower" />
      <l fromid="6760965" ns="1" title="Talk:APIIT" />
      <l fromid="12229053" ns="1" title="Talk:APILAS" />
    </alllinks>
  </query>
</api>

[edit] Possible errors

  • code: alparams
    • info: alllinks cannot be used as a generator in unique links mode
  • code: alparams
    • info: alllinks cannot return corresponding page ids in unique links mode
      • This happens when you use alunique and alprop=ids together
  • code: alparams
    • info: alcontinue and alfrom cannot be used together

[edit] allcategories / ac

MediaWiki version: 1.12

Get a list of all categories. This differs from list=allpages&alnamespace=14 in that empty categories aren't listed, and categories without description pages are.

[edit] Parameters

  • acfrom: Start listing at this category title. The category need not exist
  • acprefix: Only list category titles starting with this value
  • aclimit: Maximum amount of categories to list (10 by default)
  • acdir: In which direction to list
    • ascending: List from A to Z (default)
    • descending: List from Z to A

[edit] Example

List the first 10 categories whose name starts with "List of"

api.php ? action=query & list=allcategories & acprefix=List%20of

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <allcategories acfrom="List of Baptist sub-denominations" />
  </query-continue>
  <query>
    <allcategories>
      <c>List of &quot;M&quot; series military vehicles</c>
      <c>List of Alternative Rock Groups</c>
      <c>List of Alumni of Philippine Science High School</c>
      <c>List of American artists</c>
      <c>List of Anglicans and Episcopalians</c>
      <c>List of Arizona Reptiles</c>
      <c>List of Artists by record label</c>
      <c>List of Australian Anglicans</c>
      <c>List of Bahá'ís</c>
      <c>List of Balliol College people</c>
    </allcategories>
  </query>
</api>

[edit] Possible errors

None

[edit] allusers / au

MediaWiki version: 1.11

Get a list of registered users, ordered by username. This module cannot be used as a generator.

[edit] Parameters

  • aufrom: Start listing at this username. The user name need not exist
  • auprefix: Only list usernames starting with this value
  • augroup: Only list users in this group
    • bot
    • sysop
    • bureaucrat
    • Any other group that is defined on the wiki. This is different for every wiki; see the API help or action=paraminfo for a list of possible values
  • auprop: Which properties to return
    • editcount: The number of edits the user has made
    • groups: A list of all groups the user is in
    • registration: The date and time of the user's registration
  • aulimit: Number of users to list (10 by default)

[edit] Example

Show a list of first 5 sysops

api.php ? action=query & list=allusers & augroup=sysop & aulimit=5

<api>
  <query-continue>
    <allusers aufrom="A Train" />
  </query-continue>
  <query>
    <allusers>
      <u name="(aeropagitica)" />
      <u name="-- April" />
      <u name="17Drew" />
      <u name="23skidoo" />
      <u name="A Man In Black" />
    </allusers>
  </query>
</api>

[edit] Possible errors

None

[edit] allimages / ai

MediaWiki version: 1.12

Returns a list of all images, ordered by image title.

[edit] Parameters

  • aifrom: Start listing at this title. The title need not exist
  • aiprefix: Only list titles that start with this value
  • aiminsize: Only list images that are at least this many bytes in size
  • aimaxsize: Only list images that are at most this many bytes in size
  • ailimit: Maximum amount of images to list (10 by default)
  • aidir: In which direction to list
    • ascending: List from A to Z (default)
    • descending: List from Z to A
  • aisha1: Only list images with this SHA-1 hash. These hashes are supposed to be unique, so you can use this to track duplicates. If you run into two different images with the same hash, you should start playing the lottery
  • aisha1base36: Same as aisha1, but in base 36
  • aiprop: Which properties to get
    • timestamp: The time and date the most recent version of the image was uploaded (default)
    • user: The name of the user who uploaded the most recent version
    • comment: The edit comment for the latest upload
    • url: The URL to the most recent version of the image (default)
    • size: The image's size in bytes
    • dimensions: The image's width and height in pixels
    • mime: The image's MIME type
    • sha1: The image's SHA-1 hash
    • metadata: Image metadata, if available

[edit] Example

Show a list of first 5 images whose name starts with "Albert"

api.php ? action=query & list=allimages & ailimit=5 & aifrom=Albert & aiprop=dimensions|mime

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <allimages aifrom="Albert-einstein-biography-pictures.jpg" />
  </query-continue>
  <query>
    <allimages>
      <img name="Albert&#039;s_Real_Jamaican_Foods.JPG" width="1024" height="768" mime="image/jpeg" />
      <img name="Albert-Cashier.jpg" width="150" height="220" mime="image/jpeg" />
      <img name="Albert-Park-Brisbane-1.jpg" width="936" height="695" mime="image/jpeg" />
      <img name="Albert-Park-Brisbane-2.jpg" width="830" height="525" mime="image/jpeg" />
      <img name="Albert-Park-railway-station.jpg" width="640" height="480" mime="image/jpeg" />
    </allimages>
  </query>
</api>


[edit] backlinks / bl

MediaWiki version: 1.9

Lists pages that link to a given page, similar to Special:Whatlinkshere. Ordered by linking page title.

[edit] Parameters

  • bltitle: List pages linking to this title. The title need not exist
  • blnamespace: Only list pages in these namespaces
  • blfilterredir: How to filter redirects
    • all: List all pages regardless of their redirect flag (default)
    • redirects: Only list redirects
    • nonredirects: Don't list redirects
  • bllimit: Maximum amount of pages to list (10 by default). Maximum limit is halved if blredirect is set
  • blredirect: If set, pages linking to bltitle through a redirect will also be listed. See below for more detailed information
  • blcontinue: Used to continue a previous request

[edit] Example

Find all pages that redirect to en:Main Page.

api.php ? action=query & list=backlinks & bltitle=Main%20Page & bllimit=5 & blfilterredir=redirects

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <backlinks blcontinue="0|Main_Page|668228" />
  </query-continue>
  <query>
    <backlinks>
      <bl pageid="217224" ns="0" title="Mainpage" />
      <bl pageid="217225" ns="0" title="Main page" />
      <bl pageid="234094" ns="0" title="Main Path" />
      <bl pageid="485188" ns="4" title="Wikipedia:Main page" />
      <bl pageid="485697" ns="0" title="Main Page/" />
    </backlinks>
  </query>
</api>

[edit] Links through redirects

MediaWiki version: 1.12

When the blredirect parameter is set, this module behaves slightly differently. bllimit applies to both levels separately: if e.g. bllimit=10, at most 10 first-level pages (pages that link to bltitle) and 10 second-level pages (pages that link to bltitle through a redirect) will be listed. Continuing queries also works differently, as displayed in the following example.


Get a list of pages linking to Application programming interface

api.php ? action=query & list=backlinks & bltitle=Application_programming_interface & blredirect

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <backlinks blcontinue="0|Application_programming_interface|1191|42661" />
  </query-continue>
  <query>
    <backlinks>
      <bl pageid="1191" ns="0" title="API" redirect="">
        <redirlinks>
          <bl pageid="2807" ns="0" title="Active Directory" />
          <bl pageid="4355" ns="0" title="BBC Micro" />
          <bl pageid="8146" ns="0" title="DOS" />
          <bl pageid="9101" ns="0" title="Device driver" />
          <bl pageid="15215" ns="0" title="Internet Explorer" />
          <bl pageid="29090" ns="0" title="Software testing" />
          <bl pageid="30237" ns="0" title="Tcl" />
          <bl pageid="32612" ns="0" title="Virtual reality" />
          <bl pageid="34203" ns="0" title="XFS" />
          <bl pageid="37545" ns="0" title="Palm OS" />
        </redirlinks>
      </bl>
      <bl pageid="2141" ns="0" title="Atari ST" />
      <bl pageid="2323" ns="0" title="Amdahl&#039;s law" />
      <bl pageid="2581" ns="0" title="Apache HTTP Server" />
      <bl pageid="2753" ns="0" title="AutoCAD" />
      <bl pageid="3105" ns="0" title="AmigaOS" />
      <bl pageid="3130" ns="0" title="Advanced Power Management" />
      <bl pageid="4440" ns="0" title="Berkeley Software Distribution" />
      <bl pageid="4473" ns="0" title="BIOS" />
      <bl pageid="4706" ns="0" title="Berkeley DB" />
    </backlinks>
  </query>
</api>

When continuing this request, we see that there are more pages linking to API, and that the other first-level pages are listed again. To progress beyond Berkeley DB, we have to query-continue again and again until we've had all links to API (or increase bllimit, of course).

Continuing the previous request

api.php ? action=query & list=backlinks & bltitle=Application_programming_interface & blredirect & blcontinue=0|Application_programming_interface|1191|42661

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <backlinks blcontinue="0|Application_programming_interface|1191|56891" />
  </query-continue>
  <query>
    <backlinks>
      <bl pageid="1191" ns="0" title="API" redirect="">
        <redirlinks>
          <bl pageid="42661" ns="0" title="Myth (computer game series)" />
          <bl pageid="42750" ns="0" title="Enterprise JavaBean" />
          <bl pageid="45308" ns="0" title="XPath" />
          <bl pageid="46628" ns="0" title="Automated teller machine" />
          <bl pageid="51172" ns="0" title="DNIX" />
          <bl pageid="51746" ns="0" title="Cisco Systems" />
          <bl pageid="53076" ns="0" title="Darwin (operating system)" />
          <bl pageid="53252" ns="0" title="Liberty BASIC" />
          <bl pageid="55519" ns="0" title="NeWS" />
          <bl pageid="55888" ns="0" title="Trusted system" />
        </redirlinks>
      </bl>
      <bl pageid="2141" ns="0" title="Atari ST" />
      <bl pageid="2323" ns="0" title="Amdahl&#039;s law" />
      <bl pageid="2581" ns="0" title="Apache HTTP Server" />
      <bl pageid="2753" ns="0" title="AutoCAD" />
      <bl pageid="3105" ns="0" title="AmigaOS" />
      <bl pageid="3130" ns="0" title="Advanced Power Management" />
      <bl pageid="4440" ns="0" title="Berkeley Software Distribution" />
      <bl pageid="4473" ns="0" title="BIOS" />
      <bl pageid="4706" ns="0" title="Berkeley DB" />
    </backlinks>
  </query>
</api>

[edit] Possible errors

  • code: blbad_title_count
    • info: The backlinks query requires one title to start
      • This happens when you use titles instead of bltitle (this usage is deprecated) and specify multiple titles
  • code: bl_badcontinue
    • info: Invalid continue param. You should pass the original value returned by the previous query

[edit] blocks / bk

MediaWiki version: 1.12

List all blocks, à la Special:Ipblocklist. This module cannot be used as a generator.

[edit] Parameters

  • bkstart: The timestamp to start listing from
  • bkend: The timestamp to end listing at
  • bkdir: Direction to list in.
    • older: List newest blocks first (default). Note: bkstart has to be later than bkend.
    • newer: List oldest blocks first. Note: bkstart has to be before bkend.
  • bkids: Only list blocks with these IDs
  • bkusers: Only list blocks of these users
  • bkip: List all blocks, including range blocks, that apply to this IP address. You can also specify a CIDR range here, in which case only blocks applying to the entire range will be listed. Cannot be used together with bkusers. CIDR ranges broader than /16 are not allowed, as range blocks cannot cross /16 boundaries
  • bklimit: Maximum number of blocks to list (10 by default)
  • bkprop: A pipe-separated list of properties to get. The default value is id|user|by|timestamp|expiry|reason|flags
    • id: The ID of the block (default)
    • user: The IP address or username that was blocked (default)
    • by: The user who applied the block (default)
    • timestamp: When the block was applied (default)
    • expiry: When the block will expire (default)
    • reason: The reason for the block (default)
    • range: If an IP range was blocked, the first and last IP the block applies to
    • flags: Flags that apply to the block (default)
      • automatic: Automatically blocked because of an autoblock (see also action=block)
      • anononly: Only anonymous edits are blocked
      • nocreate: Account creation is disabled
      • autoblock: Automatic blocking is enabled for this block
      • noemail: Sending e-mail through the wiki is disabled for the blocked user
      • hidden: This block is hidden from Special:Ipblocklist. Only users with oversight permissions can see these blocks.

[edit] Example

Listing the 3 most recent blocks

api.php ? action=query & list=blocks & bkprop=id|user|by|timestamp|expiry|reason|range|flags & bklimit=3

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query>
    <blocks>
      <block id="4"
        user="123.123.0.0/16"
        userid="0"
        by="Catrope"
        byuserid="1"
        timestamp="2007-11-23T11:44:41Z"
        expiry="infinity"
        reason="Bad proxies; these folks will just have to register"
        rangestart="123.123.0.0"
        rangeend="123.123.255.255"
        anononly=""
      />
      <block
        id="2"
        user="25.50.100.200"
        userid="0"
        by="Catrope"
        byuserid="1"
        timestamp="2007-11-23T11:37:28Z"
        expiry="infinity"
        reason="Intimidating behaviour/harassment"
        rangestart="25.50.100.200"
        rangeend="25.50.100.200"
        anononly=""
        nocreate=""
      />
      <block
        id="1"
        user="Vandal01"
        userid="3"
        by="Catrope"
        byuserid="1"
        timestamp="2007-11-23T11:36:40Z"
        expiry="2007-12-23T11:36:40Z"
        reason="Spamming links to external sites"
        rangestart="0.0.0.0"
        rangeend="0.0.0.0"
        nocreate=""
        autoblock=""
        noemail=""
      />
    </blocks>
  </query>
</api>

[edit] Possible errors

None.

[edit] categorymembers / cm

MediaWiki version: 1.11

List of pages that belong to a given category, ordered by page sort title.

[edit] Parameters

  • cmtitle: The category to enumerate
  • cmnamespace: Only list pages in these namespaces
  • cmstart: Start listing at this timestamp. Can only be used with cmsort=timestamp
  • cmend: End listing at this timestamp. Can only be used with cmsort=timestamp
  • cmsort: Property to sort by
    • sortkey: The article's sort key (default)
    • timestamp: The time the article was added to the category
  • cmdir: Direction to sort in
    • asc: From A to Z or from 2002 to 2008. Note: cmstart has to be before cmend
    • desc: From Z to A or from 2008 to 2002 Note: cmstart has to be later than cmend
  • cmlimit: Maximum amount of pages to list (10 by default)
  • cmprop: Which properties to get
    • ids: page ID (default)
    • title: page title (default)
    • sortkey: sort key
    • timestamp: time and date the article was added to the category
  • cmcontinue: Used to continue a previous request

[edit] Example

Get the 10 articles most recently added to Category:Physics

api.php ? action=query & list=categorymembers & cmtitle=Category:Physics & cmsort=timestamp & cmdir=desc

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <categorymembers cmcontinue="Magnetic levitation|" />
  </query-continue>
  <query>
    <categorymembers>
      <cm pageid="1653925" ns="100" title="Portal:Physics" />
      <cm pageid="22939" ns="0" title="Physics" />
      <cm pageid="3445246" ns="0" title="Glossary of classical physics" />
      <cm pageid="25856" ns="0" title="Radiation" />
      <cm pageid="16212316" ns="14" title="Category:Gravitation" />
      <cm pageid="24489" ns="0" title="List of basic physics topics" />
      <cm pageid="4412382" ns="0" title="Friability" />
      <cm pageid="1111581" ns="0" title="Reaction (physics)" />
      <cm pageid="16178400" ns="0" title="Normal (optics)" />
      <cm pageid="14476384" ns="0" title="Mass versus weight" />
    </categorymembers>
  </query>
</api>

[edit] Possible errors

  • code: cmnotitle
    • info: The cmtitle parameter is required
  • code: cminvalidcategory
    • info: The category name you entered is not valid
  • code: cmbadcontinue
    • info: Invalid continue param. You should pass the original value returned by the previous query

[edit] embeddedin / ei

MediaWiki version: 1.9

List pages that include a certain page.

[edit] Parameters

  • eititle: List pages including this title. The title need not exist
  • einamespace: Only list pages in these namespaces
  • eifilterredir: How to filter redirects
    • all: List all pages regardless of their redirect flag (default)
    • redirects: Only list redirects
    • nonredirects: Don't list redirects
  • eilimit: Maximum amount of pages to list (10 by default)
  • eicontinue: Used to continue a previous request

[edit] Example

Find all pages that embed en:template:Stub.

api.php ? action=query & list=embeddedin & eititle=Template:Stub & eilimit=5

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <embeddedin eicontinue="10|Stub|16324457" />
  </query-continue>
  <query>
    <embeddedin>
      <ei pageid="7997510" ns="0" title="Maike Evers" />
      <ei pageid="10357370" ns="0" title="ConnectU" />
      <ei pageid="11347592" ns="0" title="Oliver B. Greene" />
      <ei pageid="11886644" ns="0" title="Godfrey Burley Group" />
      <ei pageid="14882500" ns="0" title="Contra principia negantem disputari non potest" />
    </embeddedin>
  </query>
</api>

[edit] Possible errors

  • code: eibad_title_count
    • info: The embeddedin query requires one title to start
      • This happens when you use titles instead of eititle (this usage is deprecated) and specify multiple titles
  • code: ei_badcontinue
    • info: Invalid continue param. You should pass the original value returned by the previous query

[edit] exturlusage / eu

MediaWiki version: 1.11

Get a list of pages that link to a certain URL, à la Special:Linksearch

[edit] Parameters

  • euquery: The URL to search for, without the protocol. * can be used as a wildcard. If you leave this empty, all external links will be listed, and euprotocol will be ignored
  • euprotocol: Protocol of the URL
    • The options for this parameter vary per wiki. By default, the options are http (default), https, ftp, irc, gopher, telnet, nntp, worldwind, mailto, news
  • eunamespace: Only list links from pages in these namespaces
  • eulimit: Maximum amount of pages to list (10 by default)
  • euprop: Which properties to get
    • ids: Page ID of the linking page
    • title: Title of the linking page
    • url: URL being linked to
  • euoffset: Used for continuing a previous request

[edit] Example

Get a list of pages linking to slashdot.org

api.php ? action=query & list=exturlusage & euquery=slashdot.org

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <exturlusage euoffset="11" />
  </query-continue>
  <query>
    <exturlusage>
      <eu pageid="533948" ns="2" title="User:Peter Ellis" url="http://slashdot.org" />
      <eu pageid="3274" ns="2" title="User:Alexdb" url="http://slashdot.org/" />
      <eu pageid="36471" ns="2" title="User:Joao" url="http://slashdot.org/" />
      <eu pageid="246276" ns="2" title="User:Pablo Mayrgundter" url="http://slashdot.org/" />
      <eu pageid="352958" ns="2" title="User:Yckoh" url="http://slashdot.org" />
      <eu pageid="417592" ns="2" title="User:Geekboy" url="http://slashdot.org" />
      <eu pageid="439013" ns="4" title="Wikipedia:Village pump/January 2004 archive 5" url="http://slashdot.org" />
      <eu pageid="512464" ns="2" title="User:Vaceituno" url="http://slashdot.org" />
      <eu pageid="527793" ns="4" title="Wikipedia:New user log/archive1" url="http://slashdot.org" />
      <eu pageid="592017" ns="5" title="Wikipedia talk:Announcements/Archive 1" url="http://slashdot.org/" />
    </exturlusage>
  </query>
</api>

[edit] imageusage / iu

MediaWiki version: 1.11

List of pages that include a given image. Ordered by page title.

[edit] Parameters

  • iutitle: List pages using this image. The image need not exist
  • iunamespace: Only list pages in these namespaces
  • iufilterredir: How to filter redirects
    • all: List all pages regardless of their redirect flag (default)
    • redirects: Only list redirects
    • nonredirects: Don't list redirects
  • iulimit: Maximum amount of pages to list (10 by default)
  • iuredirect: If set, pages linking to iutitle through a redirect will also be listed. See the documentation for list=backlinks for more detailed information
  • iucontinue: Used to continue a previous request

[edit] Example

Find all pages that use Image:Albert Einstein Head.jpg

api.php ? action=query & list=imageusage & iutitle=Image:Albert%20Einstein%20Head.jpg & iulimit=5

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <imageusage iucontinue="6|Albert_Einstein_Head.jpg|45864" />
  </query-continue>
  <query>
    <imageusage>
      <iu pageid="736" ns="0" title="Albert Einstein" />
      <iu pageid="2201" ns="0" title="Aage Niels Bohr" />
      <iu pageid="12432" ns="0" title="Genius" />
      <iu pageid="14400" ns="0" title="History of science" />
      <iu pageid="34523" ns="0" title="Zhu Shijie" />
    </imageusage>
  </query>
</api>

[edit] Possible errors

  • code: iubad_title_count
    • info: The imageusage query requires one title to start
      • This happens when you use titles instead of iutitle (this usage is deprecated) and specify multiple titles
  • code: iu_badcontinue
    • info: Invalid continue param. You should pass the original value returned by the previous query
  • code: iubad_image_title
    • info: The title for imageusage query must be an image

[edit] logevents / le

MediaWiki version: 1.11

Get a list of all logged events, à la Special:Log. This module cannot be used as a generator.

[edit] Parameters

  • leprop: Which properties to get
    • ids: Page ID of the page in question and log ID (default)
    • title: Title of the page in question (default)
    • type: Type of log entry (default)
    • user: User responsible for the log entry (default)
    • timestamp: Time and date the log entry was created (default)
    • comment: Log comment (default)
    • details: Extra information (not present for all log types) (default)
  • letype: Only list log entries of this type
    • block
    • protect
    • rights
    • delete
    • upload
    • move
    • import
    • patrol
    • merge
    • Extensions may add other log types
  • leuser: Only list log entries made by this user
  • letitle: Only list log entries related to this title
  • lestart: The timestamp to start listing from
  • leend: The timestamp to end listing at
  • ledir: Direction to list in
    • older: List newest log entries first (default). Note: lestart has to be later than leend.
    • newer: List oldest log entries first. Note: lestart has to be before leend.
  • lelimit: Maximum amount of log entries to list (10 by default)

[edit] Example

List the 3 most recent page moves

api.php ? action=query & list=logevents & letype=move & lelimit=3

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query-continue>
    <logevents lestart="2008-03-25T21:26:37Z" />
  </query-continue>
  <query>
    <logevents>
      <item
       logid="0"
       pageid="16577509"
       ns="1"
       <