API:Lists/All
Ugly but useful view of all lists pages combined.
Allcategories
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.12 |
GET request to list all categories that fit certain criteria relating to their titles.
This module can be used as a generator .
API documentation
![]() | The following documentation is the output of Special: |
list=allcategories (ac)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Enumerate all categories.
- acfrom
The category to start enumerating from.
- accontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- acto
The category to stop enumerating at.
- acprefix
Search for all category titles that begin with this value.
- acdir
Direction to sort in.
- One of the following values: ascending, descending
- Default: ascending
- acmin
Only return categories with at least this many members.
- Type: integer
- acmax
Only return categories with at most this many members.
- Type: integer
- aclimit
How many categories to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- acprop
Which properties to get:
- size
- Adds number of pages in the category.
- hidden
- Tags categories that are hidden with
__HIDDENCAT__
.
- Values (separate with | or alternative): hidden, size
- Default: (empty)
- List categories with information on the number of pages in each.
- api.php?action=query&list=allcategories&acprop=size [open in sandbox]
- Retrieve info about the category page itself for categories beginning List.
- api.php?action=query&generator=allcategories&gacprefix=List&prop=info [open in sandbox]
Example
GET request
Response
{
{
"batchcomplete": "",
"continue": {
"accontinue": "15th-century_churches_in_Denmark",
"continue": "-||"
},
"query": {
"allcategories": [
{
"*": "15th-century caliphs"
},
{
"*": "15th-century calligraphers"
},
{
"*": "15th-century card games"
},
...
]
}
}
Sample code
Additional notes
- This module differs from list=allpages&alnamespace=14 in that categories without descriptions will be listed, while redirects and pages where the category was never used will not.
- The response may include categories that were previously used but have since been deleted.
- Because the response may include categories that are deleted or otherwise empty, it is recommended to filter the list using
acmin=1
, so as to only return categories containing one or more members.
See also
- API:Categorymembers - list pages which are members of a certain category.
- API:Categories - a
prop
module that gets all the categories associated with a particular page. - API:Allpages - another module that can access the category namespace .
Allimages
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.13 |
GET request to list all image files, ordered by either title or timestamp.
This module can be used as a generator .
API documentation
![]() | The following documentation is the output of Special: |
list=allimages (ai)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Enumerate all images sequentially.
- aisort
Property to sort by.
- One of the following values: name, timestamp
- Default: name
- aidir
The direction in which to list.
- One of the following values: ascending, descending, newer, older
- Default: ascending
- aifrom
The image title to start enumerating from. Can only be used with aisort=name.
- aito
The image title to stop enumerating at. Can only be used with aisort=name.
- aicontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- aistart
The timestamp to start enumerating from. Can only be used with aisort=timestamp.
- Type: timestamp (allowed formats)
- aiend
The timestamp to end enumerating. Can only be used with aisort=timestamp.
- Type: timestamp (allowed formats)
- aiprop
Which file information to get:
- timestamp
- Adds timestamp for the uploaded version.
- user
- Adds the user who uploaded each file version. If the user has been revision deleted, a userhidden property will be returned.
- userid
- Add the ID of the user that uploaded each file version. If the user has been revision deleted, a userhidden property will be returned.
- comment
- Comment on the version. If the comment has been revision deleted, a commenthidden property will be returned.
- parsedcomment
- Parse the comment on the version. If the comment has been revision deleted, a commenthidden property will be returned.
- canonicaltitle
- Adds the canonical title of the file. If the file has been revision deleted, a filehidden property will be returned.
- url
- Gives URL to the file and the description page. If the file has been revision deleted, a filehidden property will be returned.
- size
- Adds the size of the file in bytes and the height, width and page count (if applicable).
- dimensions
- Alias for size.
- sha1
- Adds SHA-1 hash for the file. If the file has been revision deleted, a filehidden property will be returned.
- mime
- Adds MIME type of the file. If the file has been revision deleted, a filehidden property will be returned.
- mediatype
- Adds the media type of the file. If the file has been revision deleted, a filehidden property will be returned.
- metadata
- Lists Exif metadata for the version of the file. If the file has been revision deleted, a filehidden property will be returned.
- commonmetadata
- Lists file format generic metadata for the version of the file. If the file has been revision deleted, a filehidden property will be returned.
- extmetadata
- Lists formatted metadata combined from multiple sources. Results are HTML formatted. If the file has been revision deleted, a filehidden property will be returned.
- bitdepth
- Adds the bit depth of the version. If the file has been revision deleted, a filehidden property will be returned.
- badfile
- Adds whether the file is on the MediaWiki:Bad image list
- Values (separate with | or alternative): badfile, bitdepth, canonicaltitle, comment, commonmetadata, dimensions, extmetadata, mediatype, metadata, mime, parsedcomment, sha1, size, timestamp, url, user, userid
- Default: timestamp|url
- aiprefix
Search for all image titles that begin with this value. Can only be used with aisort=name.
- aiminsize
Limit to images with at least this many bytes.
- Type: integer
- aimaxsize
Limit to images with at most this many bytes.
- Type: integer
- aisha1
SHA1 hash of image. Overrides aisha1base36.
- aisha1base36
SHA1 hash of image in base 36 (used in MediaWiki).
- aiuser
Only return files where the last version was uploaded by this user. Can only be used with aisort=timestamp. Cannot be used together with aifilterbots.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- aifilterbots
How to filter files uploaded by bots. Can only be used with aisort=timestamp. Cannot be used together with aiuser.
- One of the following values: all, bots, nobots
- Default: all
- aimime
Disabled due to miser mode.
- Separate values with | or alternative.
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- ailimit
How many images in total to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- Show a list of files starting at the letter B.
- api.php?action=query&list=allimages&aifrom=B [open in sandbox]
- Show a list of recently uploaded files, similar to Special:NewFiles.
- api.php?action=query&list=allimages&aiprop=user|timestamp|url&aisort=timestamp&aidir=older [open in sandbox]
- Show a list of files with MIME type image/png or image/gif
- api.php?action=query&list=allimages&aimime=image/png|image/gif [open in sandbox]
- Show info about 4 files starting at the letter T.
- api.php?action=query&generator=allimages&gailimit=4&gaifrom=T&prop=imageinfo [open in sandbox]
Example
Example 1: Get images by name
GET request
Graffiti_000
. Limit the initial response to just the first three images.Response
{
"batchcomplete": "",
"continue": {
"aicontinue": "Graffiti_BTER_0001.JPG",
"continue": "-||"
},
"query": {
"allimages": [
{
"name": "Graffiti_0001.JPG",
"timestamp": "2006-10-26T01:48:05Z",
"url": "https://upload.wikimedia.org/wikipedia/en/9/98/Graffiti_0001.JPG",
"descriptionurl": "https://en.wikipedia.org/wiki/File:Graffiti_0001.JPG",
"descriptionshorturl": "https://en.wikipedia.org/w/index.php?curid=7624737",
"ns": 6,
"title": "File:Graffiti 0001.JPG"
},
{
"name": "Graffiti_0002.JPG",
"timestamp": "2006-10-26T02:03:40Z",
"url": "https://upload.wikimedia.org/wikipedia/en/6/66/Graffiti_0002.JPG",
"descriptionurl": "https://en.wikipedia.org/wiki/File:Graffiti_0002.JPG",
"descriptionshorturl": "https://en.wikipedia.org/w/index.php?curid=7624935",
"ns": 6,
"title": "File:Graffiti 0002.JPG"
},
{
"name": "Graffiti_0003.JPG",
"timestamp": "2006-10-26T08:05:08Z",
"url": "https://upload.wikimedia.org/wikipedia/en/2/2b/Graffiti_0003.JPG",
"descriptionurl": "https://en.wikipedia.org/wiki/File:Graffiti_0003.JPG",
"descriptionshorturl": "https://en.wikipedia.org/w/index.php?curid=7628426",
"ns": 6,
"title": "File:Graffiti 0003.JPG"
}
]
}
}
Sample code
Example 2: Get images by date
GET request
Response
{
"batchcomplete": "",
"continue": {
"aicontinue": "20100101190633|Ryan_Baker_12-30-2009.JPG",
"continue": "-||"
},
"query": {
"allimages": [
{
"name": "DramaQueenThatGirl.jpg",
"timestamp": "2010-01-01T18:21:57Z",
"url": "https://upload.wikimedia.org/wikipedia/en/1/17/DramaQueenThatGirl.jpg",
"descriptionurl": "https://en.wikipedia.org/wiki/File:DramaQueenThatGirl.jpg",
"descriptionshorturl": "https://en.wikipedia.org/w/index.php?curid=25646192",
"ns": 6,
"title": "File:DramaQueenThatGirl.jpg"
},
{
"name": "VS_in_viena_austria.JPG",
"timestamp": "2010-01-01T18:42:49Z",
"url": "https://upload.wikimedia.org/wikipedia/en/b/bd/VS_in_viena_austria.JPG",
"descriptionurl": "https://en.wikipedia.org/wiki/File:VS_in_viena_austria.JPG",
"descriptionshorturl": "https://en.wikipedia.org/w/index.php?curid=25646382",
"ns": 6,
"title": "File:VS in viena austria.JPG"
},
{
"name": "Vasanthamtv_channel.jpg",
"timestamp": "2010-01-01T19:03:08Z",
"url": "https://upload.wikimedia.org/wikipedia/en/1/18/Vasanthamtv_channel.jpg",
"descriptionurl": "https://en.wikipedia.org/wiki/File:Vasanthamtv_channel.jpg",
"descriptionshorturl": "https://en.wikipedia.org/w/index.php?curid=25626466",
"ns": 6,
"title": "File:Vasanthamtv channel.jpg"
}
...
]
}
}
Sample code
Parameter history
- v1.23: Introduced
aiprop=canonicaltitle
,aiprop=commonmetadata
,aiprop=extmetadata
- v1.20: Introduced
aisort
,aistart
,aiend
,aiuser
,aifilterbots
,aidir=newer
,aidir=older
- v1.18: Introduced
aimime
,aiprop=mediatype
- v1.17: Introduced
aiprop=userid
,aiprop=parsedcomment
- v1.14: Introduced
bitdepth
Additional notes
- Only the most recent version of each file is returned.
- See Data formats for more information on how to properly format dates for
aisort=timestamps
See also
- API:Images - a very similar module, but it is a
prop
, not alist
; see API:Properties and API:Lists for more details on how these two kinds of modules differ from one another. - API:Imageinfo - retrieves detailed information about image files.
- API:Stashimageinfo - retrieves information about stashed images.
- API:Fileusage - find all pages that use the given image or images.
- API:Duplicatefiles - find any duplicates of the given file or files.
Alllinks
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.11 |
GET request to list links that point to a given namespace , ordered by title.
This module can be used as a generator.
API documentation
![]() | The following documentation is the output of Special: |
list=alllinks (al)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Enumerate all links that point to a given namespace.
- alcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- alfrom
The title of the link to start enumerating from.
- alto
The title of the link to stop enumerating at.
- alprefix
Search for all linked titles that begin with this value.
- alunique
Only show distinct linked titles. Cannot be used with alprop=ids. When used as a generator, yields target pages instead of source pages.
- Type: boolean (details)
- alprop
Which pieces of information to include:
- ids
- Adds the page ID of the linking page (cannot be used with alunique).
- title
- Adds the title of the link.
- Values (separate with | or alternative): ids, title
- Default: title
- alnamespace
The namespace to enumerate.
- One of the following values: -1, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- Default: 0
- allimit
How many total items to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- aldir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- List linked titles, including missing ones, with page IDs they are from, starting at B.
- api.php?action=query&list=alllinks&alfrom=B&alprop=ids|title [open in sandbox]
- List unique linked titles.
- api.php?action=query&list=alllinks&alunique=&alfrom=B [open in sandbox]
- Gets all linked titles, marking the missing ones.
- api.php?action=query&generator=alllinks&galunique=&galfrom=B [open in sandbox]
- Gets pages containing the links.
- api.php?action=query&generator=alllinks&galfrom=B [open in sandbox]
Example
By default, this module will return duplicates if a page contains multiple links pointing to the same namespace.
This example uses alunique=1
to remove any duplicate titles in the response.
GET request
Response
{
"batchcomplete": "",
"continue": {
"alcontinue": "!!!!Hashtagging",
"continue": "-||"
},
"query": {
"alllinks": [
{
"ns": 0,
"title": "!"
},
{
"ns": 0,
"title": "!!"
},
{
"ns": 0,
"title": "!!!"
},
...
}
Sample code
Possible errors
Code | Info |
---|---|
badcontinue | Invalid continue param. You should pass the original value returned by the previous query. |
invalidparammix | The alprop=ids parameter cannot be used with alunique. This happens when you use alprop=ids and alunique together |
Additional notes
- As with other link modules within the Action API , this module returns the titles of the pages that link to the namespace, not the exact URIs to those pages.
- This module can be used as a generator.
- Previous versions would return an error if the user tried to run this module as a generator, and
alunique
was set to true. This was altered in v1.24, to allow using the module as a generator even ifalunique
is true.
See also
- API:Backlinks - lists links to a given page.
- API:Linkshere - similar to API:Backlinks , gets links to a given page. Note that, unlike API:Backlinks , which is a
list
module, API:Linkshere is aprop
module. See the respective pages on API:Properties and API:Lists for how these two kinds of modules differ. - API:Links - retrieves links on a given page or pages. Category:MediaWiki API query lists
Allpages
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.8 |
GET request to list all pages fitting certain criteria, within a given Namespace .
This module can be used as a generator .
API documentation
![]() | The following documentation is the output of Special: |
list=allpages (ap)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Enumerate all pages sequentially in a given namespace.
- apfrom
The page title to start enumerating from.
- apcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- apto
The page title to stop enumerating at.
- apprefix
Search for all page titles that begin with this value.
- apnamespace
The namespace to enumerate.
- One of the following values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- Default: 0
- apfilterredir
Which pages to list.
Note: Due to miser mode, using this may result in fewer than aplimit results returned before continuing; in extreme cases, zero results may be returned.
- One of the following values: all, nonredirects, redirects
- Default: all
- apfilterlanglinks
Filter based on whether a page has langlinks. Note that this may not consider langlinks added by extensions.
- One of the following values: all, withlanglinks, withoutlanglinks
- Default: all
- apminsize
Limit to pages with at least this many bytes.
- Type: integer
- apmaxsize
Limit to pages with at most this many bytes.
- Type: integer
- apprtype
Limit to protected pages only.
- Values (separate with | or alternative): edit, move, upload
- apprlevel
Filter protections based on protection level (must be used with apprtype= parameter).
- Values (separate with | or alternative): Can be empty, or autoconfirmed, sysop
- apprfiltercascade
Filter protections based on cascadingness (ignored when apprtype isn't set).
- One of the following values: all, cascading, noncascading
- Default: all
- apprexpiry
Which protection expiry to filter the page on:
- indefinite
- Get only pages with indefinite protection expiry.
- definite
- Get only pages with a definite (specific) protection expiry.
- all
- Get pages with any protections expiry.
- One of the following values: all, definite, indefinite
- Default: all
- aplimit
How many total pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- apdir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- Show a list of pages starting at the letter B.
- api.php?action=query&list=allpages&apfrom=B [open in sandbox]
- Show info about 4 pages starting at the letter T.
- api.php?action=query&generator=allpages&gaplimit=4&gapfrom=T&prop=info [open in sandbox]
- Show content of first 2 non-redirect pages beginning at Re.
- api.php?action=query&generator=allpages&gaplimit=2&gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content [open in sandbox]
Example
GET request
Get all pages whose title contains the text "Jungle", in whole or part.
Response
{
"batchcomplete": "",
"continue": {
"apcontinue": "Jungle_(Bakufu_Slump_album)",
"continue": "-||"
},
"query": {
"allpages": [
{
"pageid": 341265,
"ns": 0,
"title": "Jungle"
},
{
"pageid": 56461312,
"ns": 0,
"title": "Jungle-runner"
},
{
"pageid": 18698572,
"ns": 0,
"title": "Jungle/Drum n bass"
},
{
"pageid": 1487899,
"ns": 0,
"title": "Jungle2jungle"
},
{
"pageid": 30391179,
"ns": 0,
"title": "JunglePup"
}
...
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
invalidparammix | The prlevel parameter may only be used with prtype. |
See also
- Chris G's botclasses/AllPagesBot.php — a bot that retrieves all files on a wiki, utilizing this API
- API:Categorymembers — lists all pages within a category
- API:Categories — lists all categories associated with a certain page, which can aid in finding similar pages
- API:Allcategories — lists all categories fitting a certain criteria
- API:Allimages — lists all images whose file names fit a certain criteria
- API:Allusers — lists all users in alphabetical order Category:MediaWiki API query lists#Lists/All
Alltransclusions
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.21 |
GET request to list all existing and non-existing transclusions .
This module can be used as a generator .
API documentation
![]() | The following documentation is the output of Special: |
list=alltransclusions (at)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
List all transclusions (pages embedded using {{x}}), including non-existing.
- atcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- atfrom
The title of the transclusion to start enumerating from.
- atto
The title of the transclusion to stop enumerating at.
- atprefix
Search for all transcluded titles that begin with this value.
- atunique
Only show distinct transcluded titles. Cannot be used with atprop=ids. When used as a generator, yields target pages instead of source pages.
- Type: boolean (details)
- atprop
Which pieces of information to include:
- ids
- Adds the page ID of the transcluding page (cannot be used with atunique).
- title
- Adds the title of the transclusion.
- Values (separate with | or alternative): ids, title
- Default: title
- atnamespace
The namespace to enumerate.
- One of the following values: -1, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- Default: 10
- atlimit
How many total items to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- atdir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- List transcluded titles, including missing ones, with page IDs they are from, starting at B.
- api.php?action=query&list=alltransclusions&atfrom=B&atprop=ids|title [open in sandbox]
- List unique transcluded titles.
- api.php?action=query&list=alltransclusions&atunique=&atfrom=B [open in sandbox]
- Gets all transcluded titles, marking the missing ones.
- api.php?action=query&generator=alltransclusions&gatunique=&gatfrom=B [open in sandbox]
- Gets pages containing the transclusions.
- api.php?action=query&generator=alltransclusions&gatfrom=B [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"atcontinue": "!Hero_(album)",
"continue": "-||"
},
"query": {
"alltransclusions": [
{
"ns": 0,
"title": "!!Destroy-Oh-Boy!!"
},
{
"ns": 0,
"title": "!Action Pact!"
},
{
"ns": 0,
"title": "!Arriba!"
}
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
unknown_atnamespace | Unrecognized value for parameter atnamespace: value.
Results from enumerating a non-existent namespace. |
Additional notes
- This module is part of API:Alllinks .
See also
- API:Templates - Gets a list of all pages transcluded in a page.
Allusers
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.11 |
GET request to list all registered users, as ordered by username.
API documentation
![]() | The following documentation is the output of Special: |
list=allusers (au)
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
Enumerate all registered users.
- aufrom
The username to start enumerating from.
- auto
The username to stop enumerating at.
- auprefix
Search for all users that begin with this value.
- audir
Direction to sort in.
- One of the following values: ascending, descending
- Default: ascending
- augroup
Only include users in the given groups. Does not include implicit or auto-promoted groups like *, user, or autoconfirmed.
- Values (separate with | or alternative): accountcreator, autopatrolled, bot, bureaucrat, checkuser, confirmed, flow-bot, import, interface-admin, ipblock-exempt, no-ipinfo, steward, suppress, sysop, temporary-account-viewer, translationadmin, transwiki, uploader
- auexcludegroup
Exclude users in the given groups.
- Values (separate with | or alternative): accountcreator, autopatrolled, bot, bureaucrat, checkuser, confirmed, flow-bot, import, interface-admin, ipblock-exempt, no-ipinfo, steward, suppress, sysop, temporary-account-viewer, translationadmin, transwiki, uploader
- aurights
Only include users with the given rights. Does not include rights granted by implicit or auto-promoted groups like *, user, or autoconfirmed.
- Values (separate with | or alternative): abusefilter-access-protected-vars, abusefilter-bypass-blocked-external-domains, abusefilter-hidden-log, abusefilter-hide-log, abusefilter-log, abusefilter-log-detail, abusefilter-log-private, abusefilter-modify, abusefilter-modify-blocked-external-domains, abusefilter-modify-global, abusefilter-modify-restricted, abusefilter-privatedetails, abusefilter-privatedetails-log, abusefilter-protected-vars-log, abusefilter-revert, abusefilter-view, abusefilter-view-private, apihighlimits, applychangetags, autoconfirmed, autocreateaccount, autopatrol, autoreview, autoreviewrestore, badcaptcha, badoath, bigdelete, block, blockemail, bot, browsearchive, centralauth-createlocal, centralauth-lock, centralauth-merge, centralauth-rename, centralauth-suppress, centralauth-unmerge, changeemail, changetags, checkuser, checkuser-log, checkuser-temporary-account, checkuser-temporary-account-auto-reveal, checkuser-temporary-account-log, checkuser-temporary-account-no-preference, checkuser-userinfo, collectionsaveascommunitypage, collectionsaveasuserpage, confirmemail, createaccount, createpage, createtalk, delete, delete-redirect, deletechangetags, deletedhistory, deletedtext, deletelogentry, deleterevision, echo-create, edit, editautopatrolprotected, editautoreviewprotected, editcontentmodel, editeditorprotected, editextendedsemiprotected, editinterface, editmyoptions, editmyprivateinfo, editmyusercss, editmyuserjs, editmyuserjson, editmyuserjsredirect, editmywatchlist, editpatrolprotected, editprotected, editsemiprotected, editsitecss, editsitejs, editsitejson, edittrustedprotected, editusercss, edituserjs, edituserjson, enrollasmentor, extendedconfirmed, flow-create-board, flow-delete, flow-edit-post, flow-edit-title, flow-hide, flow-lock, flow-suppress, globalblock, globalblock-exempt, globalblock-whitelist, globalgroupmembership, globalgrouppermissions, hideuser, import, importupload, interwiki, ipblock-exempt, ipinfo, ipinfo-view-basic, ipinfo-view-full, ipinfo-view-log, linkpurge, lqt-merge, lqt-react, lqt-split, mailpassword, manage-all-push-subscriptions, managechangetags, managementors, markbotedits, massmessage, mergehistory, minoredit, move, move-categorypages, move-rootuserpages, move-subpages, movefile, movestable, mwoauthmanageconsumer, mwoauthmanagemygrants, mwoauthproposeconsumer, mwoauthsuppress, mwoauthupdateownconsumer, mwoauthviewprivate, mwoauthviewsuppressed, newsletter, newsletter-announce, newsletter-create, newsletter-delete, newsletter-manage, newsletter-restore, nominornewtalk, noratelimit, nuke, oathauth-api-all, oathauth-disable-for-user, oathauth-enable, oathauth-verify-user, oathauth-view-log, override-antispoof, override-export-depth, pagelang, pagetranslation, patrol, patrolmarks, protect, purge, read, renameuser, renameuser-global, renderfile, renderfile-nonstandard, reupload, reupload-own, reupload-shared, review, rollback, sboverride, securepoll-create-poll, securepoll-edit-poll, securepoll-view-voter-pii, sendemail, setmentor, sfsblock-bypass, siteadmin, skipcaptcha, spamblacklistlog, stablesettings, stashbasehtml, stashedit, suppressionlog, suppressredirect, suppressrevision, tboverride, tboverride-account, templateeditor, thanks-notification, titleblacklistlog, torunblocked, transcode-reset, transcode-status, translate, translate-groupreview, translate-import, translate-manage, translate-messagereview, unblockself, undelete, unfuzzy, unreviewedpages, unwatchedpages, upload, upload_by_url, urlshortcode, urlshortener-create-url, urlshortener-manage-url, urlshortener-view-log, userrights, userrights-interwiki, validate, viewdeletedfile, viewmyprivateinfo, viewmywatchlist, viewsuppressed
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- auprop
Which pieces of information to include:
- blockinfo
- Adds the information about a current block on the user.
- groups
- Lists groups that the user is in. This uses more server resources and may return fewer results than the limit.
- implicitgroups
- Lists all the groups the user is automatically in.
- rights
- Lists rights that the user has.
- editcount
- Adds the edit count of the user.
- registration
- Adds the timestamp of when the user registered if available (may be blank).
- centralids
- Adds the central IDs and attachment status for the user.
- Values (separate with | or alternative): blockinfo, centralids, editcount, groups, implicitgroups, registration, rights
- aulimit
How many total usernames to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- auwitheditsonly
Only list users who have made edits.
- Type: boolean (details)
- auactiveusers
Only list users active in the last 30 days.
- Type: boolean (details)
- auattachedwiki
With auprop=centralids, also indicate whether the user is attached with the wiki identified by this ID.
- auexcludenamed
Exclude users of named accounts.
- Type: boolean (details)
- auexcludetemp
Exclude users of temporary accounts.
- Type: boolean (details)
- List users starting at Y.
- api.php?action=query&list=allusers&aufrom=Y [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"aufrom": "Drovark",
"continue": "-||"
},
"query": {
"allusers": [
{
"userid": 13239275,
"name": "Drov"
},
{
"userid": 7080866,
"name": "Drova"
},
{
"userid": 16013473,
"name": "Drova 82"
},
...
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
augroup-excludegroup | group and excludegroup cannot be used together |
Parameter history
- v1.12: Introduced
auprop=registration
Additional notes
- This API call is case sensitive, so
aufrom=DROV
doesn't return the same results asaufrom=Drov
. - All registered usernames are saved and retrieved in capitalized form. If you are using
aufrom
orauprefix
in your query, make sure you are passing them values that start with an uppercase character. - Although the default behavior is to list any user in the database, we can also limit our response to only those users who belong to a certain group, such as sysops, or bots. User groups are how MediaWiki grants users certain rights and privileges; see Help:User rights and groups for more details on how this system works.
See also
- API:Users - finds information about a list of users.
Backlinks
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.9 |
GET request to list pages which link to a certain page.
API documentation
![]() | The following documentation is the output of Special: |
list=backlinks (bl)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Find all pages that link to the given page.
- bltitle
Title to search. Cannot be used together with blpageid.
- blpageid
Page ID to search. Cannot be used together with bltitle.
- Type: integer
- blcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- blnamespace
The namespace to enumerate.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- bldir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- blfilterredir
How to filter for redirects. If set to nonredirects when blredirect is enabled, this is only applied to the second level.
- One of the following values: all, nonredirects, redirects
- Default: all
- bllimit
How many total pages to return. If blredirect is enabled, the limit applies to each level separately (which means up to 2 * bllimit results may be returned).
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- blredirect
If linking page is a redirect, find all pages that link to that redirect as well. Maximum limit is halved.
- Type: boolean (details)
- Show links to MediaWiki.
- api.php?action=query&list=backlinks&bltitle=MediaWiki [open in sandbox]
- Get information about pages linking to MediaWiki.
- api.php?action=query&generator=backlinks&gbltitle=MediaWiki&prop=info [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"blcontinue": "1|987",
"continue": "-||"
},
"query": {
"backlinks": [
{
"pageid": 12,
"ns": 0,
"title": "Anarchism"
},
{
"pageid": 128,
"ns": 1,
"title": "Talk:Atlas Shrugged"
},
{
"pageid": 336,
"ns": 0,
"title": "Altruism"
},
...
]
}
}
Sample code
Redirects
In the example above, only direct links to the philosophy page are returned.
When blredirect
is set, the response will include any pages which backlink to redirects for the value in bltitle
.
These redirected backlinks are treated as separate groups within the response hierarchy, one level down from the redirect itself.
The limit set in bllimit
applies separately to each level of the response, so bllimit=25
would return up to 25 direct backlinks, and up to 25 backlinks within each individual redirect.
In addition, using blcontinue
when a redirect was in the response will return more second-level backlinks, before finally moving on to more direct backlinks, once all the backlinks for a redirect have been returned in full.
Possible errors
Code | Info |
---|---|
blbadcontinue | Invalid continue param. You should pass the original value returned by the previous query. |
See also
- API:Linkshere - finds all pages that link to a given page. Note that, unlike API:Backlinks, which is a
list
module, API:Linkshere is aprop
module. See the respective pages on API:Properties and API:Lists for how these two kinds of modules differ. - API:Transcludedin - a
prop
module that finds all pages that transclude (i.e. embed information from) the given pages. - API:Embeddedin - a
list
module which lists backlinks via transclusion, similar to Special:Whatlinkshere. - API:Imageusage - lists pages that use the given image(s).
- API:Fileusage - lists pages that use the given file(s).
- API:Globalusage - lists pages on other wikis that use the given file(s), similar to Special:GlobalUsage. Category:MediaWiki API query lists
Blocks
![]() | This page is part of the MediaWiki Action API documentation. |
GET request to list currently-blocked users, in the same manner as Special:BlockList lists them.
MediaWiki version: | ≥ 1.12 |
API documentation
![]() | The following documentation is the output of Special: |
list=blocks (bk)
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
List all blocked users and IP addresses.
- bkstart
The timestamp to start enumerating from.
- Type: timestamp (allowed formats)
- bkend
The timestamp to stop enumerating at.
- Type: timestamp (allowed formats)
- bkdir
In which direction to enumerate:
- newer
- List oldest first. Note: bkstart has to be before bkend.
- older
- List newest first (default). Note: bkstart has to be later than bkend.
- One of the following values: newer, older
- Default: older
- bkids
List of block IDs to list (optional).
- Type: list of integers
- Separate values with | or alternative.
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- bkusers
List of users to search for (optional).
- Type: list of users, by any of username, IP, Temporary user and IP range
- Separate values with | or alternative.
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- bkip
Get all blocks applying to this IP address or CIDR range, including range blocks. Cannot be used together with bkusers. CIDR ranges broader than IPv4/16 or IPv6/19 are not accepted.
- bklimit
The maximum number of blocks to list.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- bkprop
Which properties to get:
- id
- Adds the ID of the block.
- user
- Adds the username of the blocked user.
- userid
- Adds the user ID of the blocked user.
- by
- Adds the username of the blocking user.
- byid
- Adds the user ID of the blocking user.
- timestamp
- Adds the timestamp of when the block was given.
- expiry
- Adds the timestamp of when the block expires.
- reason
- Adds the reason given for the block.
- parsedreason
- Adds the parsed reason given for the block.
- range
- Adds the range of IP addresses affected by the block.
- flags
- Tags the ban with (autoblock, anononly, etc.).
- restrictions
- Adds the partial block restrictions if the block is not sitewide.
- Values (separate with | or alternative): by, byid, expiry, flags, id, parsedreason, range, reason, restrictions, timestamp, user, userid
- Default: id|user|by|timestamp|expiry|reason|flags
- bkshow
Show only items that meet these criteria. For example, to see only indefinite blocks on IP addresses, set bkshow=ip|!temp.
- Values (separate with | or alternative): !account, !ip, !range, !temp, account, ip, range, temp
- bkcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- List blocks.
- api.php?action=query&list=blocks [open in sandbox]
- List blocks of users Alice and Bob.
- api.php?action=query&list=blocks&bkusers=Alice|Bob [open in sandbox]
Example
Lists the 3 most recent blocks
GET request
Response
{
"batchcomplete": "",
"continue": {
"bkcontinue": "20190226192632|8865878",
"continue": "-||"
},
"query": {
"blocks": [
{
"id": 8865881,
"user": "168.11.166.47",
"by": "Gilliam",
"timestamp": "2019-02-26T19:28:56Z",
"expiry": "2020-02-26T19:28:56Z",
"reason": "{{school block}}",
"rangestart": "168.11.166.47",
"rangeend": "168.11.166.47",
"anononly": "",
"nocreate": "",
"allowusertalk": ""
},
{
"id": 8865880,
"user": "64.125.67.43",
"by": "Gilliam",
"timestamp": "2019-02-26T19:27:44Z",
"expiry": "2019-03-01T19:27:44Z",
"reason": "part of mass attack",
"rangestart": "64.125.67.43",
"rangeend": "64.125.67.43",
"anononly": "",
"nocreate": "",
"allowusertalk": ""
}
...
]
}
}
Sample code
Additional notes
- This module cannot be used as a generator.
Parameter history
- v1.19: Introduced
bkshow
- v1.18: Introduced
userid
See also
Categorymembers
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.11 |
GET request to list pages that belong to a given category.
API documentation
![]() | The following documentation is the output of Special: |
list=categorymembers (cm)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
List all pages in a given category.
- cmtitle
Which category to enumerate (required). Must include the Category: prefix. Cannot be used together with cmpageid.
- cmpageid
Page ID of the category to enumerate. Cannot be used together with cmtitle.
- Type: integer
- cmprop
Which pieces of information to include:
- ids
- Adds the page ID.
- title
- Adds the title and namespace ID of the page.
- sortkey
- Adds the sortkey used for sorting in the category (hexadecimal string).
- sortkeyprefix
- Adds the sortkey prefix used for sorting in the category (human-readable part of the sortkey).
- type
- Adds the type that the page has been categorised as (page, subcat or file).
- timestamp
- Adds the timestamp of when the page was included.
- Values (separate with | or alternative): ids, sortkey, sortkeyprefix, timestamp, title, type
- Default: ids|title
- cmnamespace
Only include pages in these namespaces. Note that cmtype=subcat or cmtype=file may be used instead of cmnamespace=14 or 6.
Note: Due to miser mode, using this may result in fewer than cmlimit results returned before continuing; in extreme cases, zero results may be returned.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- cmtype
Which type of category members to include. Ignored when cmsort=timestamp is set.
- Values (separate with | or alternative): file, page, subcat
- Default: page|subcat|file
- cmcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- cmlimit
The maximum number of pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- cmsort
Property to sort by.
- One of the following values: sortkey, timestamp
- Default: sortkey
- cmdir
In which direction to sort.
- One of the following values: asc, ascending, desc, descending, newer, older
- Default: ascending
- cmstart
Timestamp to start listing from. Can only be used with cmsort=timestamp.
- Type: timestamp (allowed formats)
- cmend
Timestamp to end listing at. Can only be used with cmsort=timestamp.
- Type: timestamp (allowed formats)
- cmstarthexsortkey
Sortkey to start listing from, as returned by cmprop=sortkey. Can only be used with cmsort=sortkey.
- cmendhexsortkey
Sortkey to end listing at, as returned by cmprop=sortkey. Can only be used with cmsort=sortkey.
- cmstartsortkeyprefix
Sortkey prefix to start listing from. Can only be used with cmsort=sortkey. Overrides cmstarthexsortkey.
- cmendsortkeyprefix
Sortkey prefix to end listing before (not at; if this value occurs it will not be included!). Can only be used with cmsort=sortkey. Overrides cmendhexsortkey.
- cmstartsortkey
- Deprecated.
Use cmstarthexsortkey instead.
- cmendsortkey
- Deprecated.
Use cmendhexsortkey instead.
- Get first 10 pages in Category:Physics.
- api.php?action=query&list=categorymembers&cmtitle=Category:Physics [open in sandbox]
- Get page info about first 10 pages in Category:Physics.
- api.php?action=query&generator=categorymembers&gcmtitle=Category:Physics&prop=info [open in sandbox]
Example 1: List twenty pages in a category
GET request
Response
Response |
---|
{
"api": {
"query-continue": {
"categorymembers": {
"_cmcontinue": "subcat|44594e414d494353|10998823"
}
},
"query": {
"categorymembers": {
"cm": [
{
"_pageid": "22688097",
"_ns": "0",
"_title": "Branches of physics"
},
{
"_pageid": "3445246",
"_ns": "0",
"_title": "Glossary of classical physics"
},
{
"_pageid": "24489",
"_ns": "0",
"_title": "Outline of physics"
},
...
]
}
}
}
}
|
Sample code
get_category_items.py |
---|
Example 2: Get the ten articles most recently added to a category
GET request
Response
Response |
---|
{
"api": {
"query-continue": {
"categorymembers": {
"_cmcontinue": "Magnetic levitation|"
}
},
"query": {
"categorymembers": {
"cm": [
{
"_pageid": "1653925",
"_ns": "100",
"_title": "Portal:Physics"
},
{
"_pageid": "22939",
"_ns": "0",
"_title": "Physics"
},
{
"_pageid": "3445246",
"_ns": "0",
"_title": "Glossary of classical physics"
},
...
]
}
}
}
}
|
Sample code
get_recent_category_items.py |
---|
Example 3: Get ten subcategories of a category
GET request
Response
Response |
---|
{
"api": {
"query-continue": {
"categorymembers": {
"_cmcontinue": "subcat|57494b4950454449412050454f504c45|41491664"
}
},
"query": {
"categorymembers": {
"cm": [
{
"_pageid": "1458692",
"_ns": "14",
"_title": "Category:Wikipedias by language"
},
{
"_pageid": "22918730",
"_ns": "14",
"_title": "Category:Books about Wikipedia"
},
{
"_pageid": "16957584",
"_ns": "14",
"_title": "Category:Critics of Wikipedia"
},
...
]
}
}
}
}
|
The next subcategories (if there're more than 10) can be continued using the cmcontinue
parameter from the response above.
Sample code
get_subcategories.py |
---|
Possible errors
Code | Info |
---|---|
cmnotitle | The parameter cmtitle is required. |
cminvalidcategory | The category name you entered is not valid. |
cmbadcontinue | Invalid continue param. You should pass the original value returned by the previous query. |
Parameter history
- v1.24: Deprecated
cmstartsortkey
,cmendsortkey
- v1.18: Introduced
cmstartsortkeyprefix
,cmendsortkeyprefix
- v1.17: Introduced
sortkeyprefix
,type
- v1.14: Introduced
cmstartsortkey
,cmendsortkey
- v1.12: Introduced
cmtype
,cmstart
,cmend
,cmdir
See also
- API:Allpages - lists all pages fitting certain criteria
- API:Categories - lists categories associated with a page
- API:Allcategories - lists all categories on a wiki Category:MediaWiki API query lists
deletedrevs
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≤ 1.25 |
alldeletedrevisions
apiGET request to list deleted revisions.
API documentation
![]() | The following documentation is the output of Special: |
list=deletedrevs (dr)
- This module is deprecated.
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
List deleted revisions.
Operates in three modes:
- List deleted revisions for the given titles, sorted by timestamp.
- List deleted contributions for the given user, sorted by timestamp (no titles specified).
- List all deleted revisions in the given namespace, sorted by title and timestamp (no titles specified, druser not set).
Certain parameters only apply to some modes and are ignored in others.
- drstart
The timestamp to start enumerating from.
- Modes: 1, 2
- Type: timestamp (allowed formats)
- drend
The timestamp to stop enumerating at.
- Modes: 1, 2
- Type: timestamp (allowed formats)
- drdir
In which direction to enumerate:
- newer
- List oldest first. Note: drstart has to be before drend.
- older
- List newest first (default). Note: drstart has to be later than drend.
- Modes: 1, 3
- One of the following values: newer, older
- Default: older
- drfrom
Start listing at this title.
- Mode: 3
- drto
Stop listing at this title.
- Mode: 3
- drprefix
Search for all page titles that begin with this value.
- Mode: 3
- drunique
List only one revision for each page.
- Mode: 3
- Type: boolean (details)
- drnamespace
Only list pages in this namespace.
- Mode: 3
- One of the following values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- Default: 0
- drtag
Only list revisions tagged with this tag.
- druser
Only list revisions by this user.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- drexcludeuser
Don't list revisions by this user.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- drprop
Which properties to get:
- revid
- Adds the revision ID of the deleted revision.
- parentid
- Adds the revision ID of the previous revision to the page.
- user
- Adds the user who made the revision.
- userid
- Adds the ID of the user who made the revision.
- comment
- Adds the comment of the revision.
- parsedcomment
- Adds the parsed comment of the revision.
- minor
- Tags if the revision is minor.
- len
- Adds the length (bytes) of the revision.
- sha1
- Adds the SHA-1 (base 16) of the revision.
- content
- Adds the content of the revision. For performance reasons, if this option is used, drlimit is enforced to 50.
- token
- Deprecated. Gives the edit token.
- tags
- Tags for the revision.
- Values (separate with | or alternative): comment, content, len, minor, parentid, parsedcomment, revid, sha1, tags, user, userid, token
- Default: user|comment
- drlimit
The maximum amount of revisions to list. If drprop=content is used, the limit is 50.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- drcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- List the last deleted revisions of the pages MediaWiki and Talk:Main Page, with content (mode 1).
- api.php?action=query&list=deletedrevs&titles=MediaWiki|Talk%3AMediaWiki&drprop=user|comment|content [open in sandbox]
- List the last 50 deleted contributions by Bob (mode 2).
- api.php?action=query&list=deletedrevs&druser=Bob&drlimit=50 [open in sandbox]
- List the first 50 deleted revisions in the main namespace (mode 3).
- api.php?action=query&list=deletedrevs&drdir=newer&drlimit=50 [open in sandbox]
- List the first 50 deleted pages in the Talk namespace (mode 3).
- api.php?action=query&list=deletedrevs&drdir=newer&drlimit=50&drnamespace=1&drunique= [open in sandbox]
Example
GET request
Response
<?xml version="1.0" encoding="utf-8"?>
<api>
<query-continue>
<deletedrevs drstart="20070904142729" />
</query-continue>
<query>
<deletedrevs>
<page title="Main Page" ns="0" token="e4c475f13be7824135b4edbebf4140ff+\">
<revisions>
<rev timestamp="20070904200804" revid="31" user="Catrope" minor="" len="" />
<rev timestamp="20070904200753" revid="30" user="Catrope" minor="" len="" />
<rev timestamp="20070904193501" revid="29" user="Catrope" minor="" len="568" />
<rev timestamp="20070904193213" revid="28" user="Catrope" minor="" len="470" />
</revisions>
</page>
<page title="User:Catrope" ns="2" token="e4c475f13be7824135b4edbebf4140ff+\">
<revisions>
<rev timestamp="20070904143938" revid="24" user="Catrope" len="52" />
<rev timestamp="20070904142758" revid="23" user="Catrope" len="37" />
</revisions>
</page>
</deletedrevs>
</query>
</api>
Sample code
get_deleted_revisions.py
#!/usr/bin/python3
"""
get_deleted_revisions.py
MediaWiki Action API Code Samples
Demo of `Deletedrevs` module: List the six most recent deleted revisions
from User:Catrope
MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
"drend": "20070904000000",
"format": "json",
"druser": "Catrope",
"list": "deletedrevs",
"drstart": "20070904235959",
"drlimit": "6",
"drprop": "revid|user|minor|len|token",
"action": "query"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print(DATA)
Possible errors
Code | Info |
---|---|
drpermissiondenied | You don't have permission to view deleted revision information. On most wikis, viewing deleted revisions is restricted to sysops, but other wikis may have different rules. |
Parameter history
- v1.24: Deprecated
drprop: token
- v1.23: Introduced
drtag
,drprop: tags
- v1.19: Introduced
drprop: sha1
- v1.18: Introduced
drto
,drprefix
,drprop: parentid
- v1.17: Introduced
drprop: userid
- v1.16: Introduced
drprop: parsedcomment
- v1.15: Introduced
druser
,drexcludeuser
,drnamespace
,drunique
,drfrom
Additional notes
- This module cannot be used as a generator .
- You need the
deletedhistory
right to use this module. This module can be used in one of three modes:- List deleted revisions for the given titles (through
titles
or a generator), sorted by timestamp - List deleted contributions for a certain user, sorted by timestamp (
druser
set, no titles given) - List all deleted revisions in a certain namespace (
druser
not set, no titles given)
- List deleted revisions for the given titles (through
- Some parameters are restricted to certain modes only, and are marked accordingly.
See also
Embeddedin
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.11 |
GET request to find all page(s) that embed a given page.
This module can be used as a generator .
API documentation
![]() | The following documentation is the output of Special: |
list=embeddedin (ei)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Find all pages that embed (transclude) the given title.
- eititle
Title to search. Cannot be used together with eipageid.
- eipageid
Page ID to search. Cannot be used together with eititle.
- Type: integer
- eicontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- einamespace
The namespace to enumerate.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- eidir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- eifilterredir
How to filter for redirects.
- One of the following values: all, nonredirects, redirects
- Default: all
- eilimit
How many total pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- Show pages transcluding Template:Stub.
- api.php?action=query&list=embeddedin&eititle=Template:Stub [open in sandbox]
- Get information about pages transcluding Template:Stub.
- api.php?action=query&generator=embeddedin&geititle=Template:Stub&prop=info [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"query": {
"embeddedin": [
{
"pageid": 14388072,
"ns": 100,
"title": "Portal:Computing"
},
{
"pageid": 45719527,
"ns": 2,
"title": "User:SoSivr/sandbox"
}
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
missingparam | One of the parameters eititle, eipageid is required. |
eibadcontinue | Invalid continue param. You should pass the original value returned by the previous query. |
See also
- API:Transcludedin - Find all pages that transclude the given pages.
- API:Templates - Returns all pages transcluded on the given pages.
- API:Alltransclusions - Part of API:Alllinks module. This API gets a list all transclusions (pages embedded using
{{x}}
), including non-existing. - API:Parsing wikitext - Parse content of a page and obtain the output.
Exturlusage
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.11 |
GET request to list pages that link to a certain URL, like Special:Linksearch.
API documentation
![]() | The following documentation is the output of Special: |
list=exturlusage (eu)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Enumerate pages that contain a given URL.
- euprop
Which pieces of information to include:
- ids
- Adds the ID of page.
- title
- Adds the title and namespace ID of the page.
- url
- Adds the URL used in the page.
- Values (separate with | or alternative): ids, title, url
- Default: ids|title|url
- eucontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- euprotocol
Protocol of the URL. If empty and euquery is set, the protocol is http and https. Leave both this and euquery empty to list all external links.
- One of the following values: Can be empty, or bitcoin, ftp, ftps, geo, git, gopher, http, https, irc, ircs, magnet, mailto, matrix, mms, news, nntp, redis, sftp, sip, sips, sms, ssh, svn, tel, telnet, urn, wikipedia, worldwind, xmpp
- Default: (empty)
- euquery
Search string without protocol. See Special:LinkSearch. Leave empty to list all external links.
- eunamespace
The page namespaces to enumerate.
Note: Due to miser mode, using this may result in fewer than eulimit results returned before continuing; in extreme cases, zero results may be returned.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- eulimit
How many pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- euexpandurl
- Deprecated.
Expand protocol-relative URLs with the canonical protocol.
- Type: boolean (details)
Example
GET request
Get a list of pages linking to slashdot.org
Response
{
"batchcomplete": "",
"continue": {
"eucontinue": "http://org.slashdot./|169423",
"continue": "-||"
},
"query": {
"exturlusage": [
{
"pageid": 533948,
"ns": 2,
"title": "User:Peter Ellis",
"url": "http://slashdot.org"
},
{
"pageid": 3274,
"ns": 2,
"title": "User:Alexdb",
"url": "http://slashdot.org/"
},
{
"pageid": 36471,
"ns": 2,
"title": "User:Joao",
"url": "http://slashdot.org/"
}
...
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
unknown_euprotocol | Wrong property for protocol parameter (use value from the list of supported protocols) |
badcontinue | Invalid continue param. You should pass the original value returned by the previous query. |
Parameter history
- v1.21: Introduced
euexpandurl
See also
- API:Backlinks - lists links to a given page.
- API:Links - retrieves links on a given page or pages.
- API:Iwlinks - Find interwiki links on a given page (i.e, meta pages, special pages).
- API:Extlinks - Find all external links on a given page.
- API:Langlinks - Get a list of language links from the given page. Language links represent translations.
- API:Langbacklinks - Get a list of pages that contains a given language link.
Filearchive
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.17 |
GET request to enumerate all deleted files from filearchive table sequentially.
API documentation
![]() | The following documentation is the output of Special: |
list=filearchive (fa)
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
Enumerate all deleted files sequentially.
- fafrom
The image title to start enumerating from.
- fato
The image title to stop enumerating at.
- faprefix
Search for all image titles that begin with this value.
- fadir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- fasha1
SHA1 hash of image. Overrides fasha1base36.
- fasha1base36
SHA1 hash of image in base 36 (used in MediaWiki).
- faprop
Which image information to get:
- sha1
- Adds SHA-1 hash for the image.
- timestamp
- Adds timestamp for the uploaded version.
- user
- Adds user who uploaded the image version.
- size
- Adds the size of the image in bytes and the height, width and page count (if applicable).
- dimensions
- Alias for size.
- description
- Adds description of the image version.
- parseddescription
- Parse the description of the version.
- mime
- Adds MIME of the image.
- mediatype
- Adds the media type of the image.
- metadata
- Lists Exif metadata for the version of the image.
- bitdepth
- Adds the bit depth of the version.
- archivename
- Adds the filename of the archive version for non-latest versions.
- Values (separate with | or alternative): archivename, bitdepth, description, dimensions, mediatype, metadata, mime, parseddescription, sha1, size, timestamp, user
- Default: timestamp
- falimit
How many images to return in total.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- facontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- Show a list of all deleted files.
- api.php?action=query&list=filearchive [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"facontinue": "0000007.jpg|20070128133944|288",
"continue": "-||"
},
"query": {
"filearchive": [
{
"id": 1778,
"name": "!notedit.png",
"ns": 6,
"title": "File:!notedit.png",
"timestamp": "2011-04-25T13:17:47Z"
},
{
"id": 6949,
"name": "\"Twilight_at_the_pond\"_by_A.A.Tutunov_(1976).jpg",
"ns": 6,
"title": "File:\"Twilight at the pond\" by A.A.Tutunov (1976).jpg",
"timestamp": "2019-01-26T11:48:52Z"
},
{
"id": 5814,
"name": "---C--temp-Regelwerk.pdf",
"ns": 6,
"title": "File:---C--temp-Regelwerk.pdf",
"timestamp": "2017-03-09T10:09:24Z"
},
...
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
cantview-deleted-description | You don't have permission to view descriptions of deleted files. |
cantview-deleted-metadata | You don't have permission to view metadata of deleted files. |
invalidsha1hash | The SHA1 hash provided is not valid. |
invalidsha1base36hash | The SHA1Base36 hash provided is not valid. |
Parameter history
- v1.20: Introduced
facontinue
,mediatype
,archivename
- v1.18: Introduced
fato
,fasha1
,fasha1base36
,parseddescription
Imageusage
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.9 |
GET request to find all pages that use a given image title.
This module can be used as a generator .
API documentation
![]() | The following documentation is the output of Special: |
list=imageusage (iu)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Find all pages that use the given image title.
- iutitle
Title to search. Cannot be used together with iupageid.
- iupageid
Page ID to search. Cannot be used together with iutitle.
- Type: integer
- iucontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- iunamespace
The namespace to enumerate.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- iudir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- iufilterredir
How to filter for redirects. If set to nonredirects when iuredirect is enabled, this is only applied to the second level.
- One of the following values: all, nonredirects, redirects
- Default: all
- iulimit
How many total pages to return. If iuredirect is enabled, the limit applies to each level separately (which means up to 2 * iulimit results may be returned).
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- iuredirect
If linking page is a redirect, find all pages that link to that redirect as well. Maximum limit is halved.
- Type: boolean (details)
- Show pages using File:Albert Einstein Head.jpg.
- api.php?action=query&list=imageusage&iutitle=File:Albert%20Einstein%20Head.jpg [open in sandbox]
- Get information about pages using File:Albert Einstein Head.jpg.
- api.php?action=query&generator=imageusage&giutitle=File:Albert%20Einstein%20Head.jpg&prop=info [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"continue": "-||",
"iucontinue": "4|33464895"
},
"query": {
"imageusage": [
{
"ns": 0,
"pageid": 14072,
"title": "History of Wikipedia"
},
{
"ns": 4,
"pageid": 16842768,
"title": "Wikipedia:Wikipedia logos"
},
{
"ns": 2,
"pageid": 30536602,
"title": "User:J Komara"
}
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
iubadcontinue | Invalid continue param. You should pass the original value returned by the previous query. |
See also
- API:Images - Lists embedded media files on provided pages.
- API:Allimages - Lists all images, by title or timestamp.
- API:Imageinfo - Gets information for any titles in the image namespace.
- API:Stashimageinfo - Gets information for stashed images or files in the namespace.
- API:Duplicatefiles - Lists any duplicates of the given images or files.
Iwbacklinks
![]() | This page is part of the MediaWiki Action API documentation. |
GET request to get all pages that link to the given interwiki link.
MediaWiki version: | ≥ 1.17 |
API documentation
![]() | The following documentation is the output of Special: |
list=iwbacklinks (iwbl)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Find all pages that link to the given interwiki link.
Can be used to find all links with a prefix, or all links to a title (with a given prefix). Using neither parameter is effectively "all interwiki links".
- iwblprefix
Prefix for the interwiki.
- iwbltitle
Interwiki link to search for. Must be used with iwblblprefix.
- iwblcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- iwbllimit
How many total pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- iwblprop
Which properties to get:
- iwprefix
- Adds the prefix of the interwiki.
- iwtitle
- Adds the title of the interwiki.
- Values (separate with | or alternative): iwprefix, iwtitle
- Default: (empty)
- iwbldir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- Get pages linking to wikibooks:Test.
- api.php?action=query&list=iwbacklinks&iwbltitle=Test&iwblprefix=wikibooks [open in sandbox]
- Get information about pages linking to wikibooks:Test.
- api.php?action=query&generator=iwbacklinks&giwbltitle=Test&giwblprefix=wikibooks&prop=info [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"iwblcontinue": "wikibooks|Main_Page|438739",
"continue": "-||"
},
"query": {
"iwbacklinks": [
{
"pageid": 18606,
"ns": 0,
"title": "Liberation Tigers of Tamil Eelam"
},
{
"pageid": 43347,
"ns": 1,
"title": "Talk:Vi"
},
...
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
invalidparammix-mustusewith | The iwbltitle parameter may only be used with iwblprefix. |
Parameter history
- v1.20: Introduced
iwbldir
Additional notes
- This module can be used to find all pages that link to the given interwiki link. It finds all links using a prefix, or all links to a given title (with a given prefix). Using neither parameter returns
All IW Links
.
See also
- API:Iwlinks - List interwiki links from a given page.
- API:Links - Find all the links on the provided page(s).
- API:Linkshere - Find all pages that link to the given pages.
- API:Extlinks - Gets a list of all external links on the provided pages.
Langbacklinks
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.18 |
GET request to find all pages that link to the given language link.
API documentation
![]() | The following documentation is the output of Special: |
list=langbacklinks (lbl)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Find all pages that link to the given language link.
Can be used to find all links with a language code, or all links to a title (with a given language). Using neither parameter is effectively "all language links".
Note that this may not consider language links added by extensions.
- lbllang
Language for the language link.
- lbltitle
Language link to search for. Must be used with lbllang.
- lblcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- lbllimit
How many total pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- lblprop
Which properties to get:
- lllang
- Adds the language code of the language link.
- lltitle
- Adds the title of the language link.
- Values (separate with | or alternative): lllang, lltitle
- Default: (empty)
- lbldir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- Get pages linking to fr:Test.
- api.php?action=query&list=langbacklinks&lbltitle=Test&lbllang=fr [open in sandbox]
- Get information about pages linking to fr:Test.
- api.php?action=query&generator=langbacklinks&glbltitle=Test&glbllang=fr&prop=info [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"query": {
"langbacklinks": []
}
}
Sample code
Possible errors
Code | Info |
---|---|
missingparam | The lang parameter must be set. |
Parameter history
- v1.20: Introduced
dir
Additional notes
- This module can be used to find all pages that link to the given language link. It finds all links using a language code, or all links to a given title (with a given language). Using neither parameter is effectively
All Language Links
.
See also
- API:Links - Returns all links from the given pages.
- API:Langlinks - Gets a list of all language links from the provided pages to other languages.
Logevents
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.9 |
GET request to fetch a list of all logged events as shown in Special:Log.
API documentation
![]() | The following documentation is the output of Special: |
list=logevents (le)
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
Get events from logs.
- leprop
Which properties to get:
- ids
- Adds the ID of the log event.
- title
- Adds the title of the page for the log event.
- type
- Adds the type of log event.
- user
- Adds the user responsible for the log event. If the user has been revision deleted, a userhidden property will be returned.
- userid
- Adds the user ID who was responsible for the log event. If the user has been revision deleted, a userhidden property will be returned.
- timestamp
- Adds the timestamp for the log event.
- comment
- Adds the comment of the log event. If the comment has been revision deleted, a commenthidden property will be returned.
- parsedcomment
- Adds the parsed comment of the log event. If the comment has been revision deleted, a commenthidden property will be returned.
- details
- Lists additional details about the log event. If the log event has been revision deleted, an actionhidden property will be returned.
- tags
- Lists tags for the log event.
- Values (separate with | or alternative): comment, details, ids, parsedcomment, tags, timestamp, title, type, user, userid
- Default: ids|title|type|user|timestamp|comment|details
- letype
Filter log entries to only this type.
- One of the following values: Can be empty, or abusefilter, abusefilter-protected-vars, abusefilterblockeddomainhit, abusefilterprivatedetails, block, checkuser-temporary-account, contentmodel, create, delete, gblblock, gblrename, gblrights, globalauth, import, interwiki, ipinfo, liquidthreads, managetags, massmessage, merge, messagebundle, move, newsletter, newusers, notifytranslators, oath, pagelang, pagetranslation, patrol, protect, renameuser, rights, spamblacklist, suppress, tag, thanks, timedmediahandler, titleblacklist, translationreview, upload, urlshortener, usermerge
- leaction
Filter log actions to only this action. Overrides letype. In the list of possible values, values with the asterisk wildcard such as action/* can have different strings after the slash (/).
- One of the following values: abusefilter-protected-vars/*, abusefilter/create, abusefilter/hit, abusefilter/modify, abusefilterblockeddomainhit/*, abusefilterprivatedetails/access, block/block, block/reblock, block/unblock, checkuser-private-event/*, checkuser-temporary-account/*, contentmodel/change, contentmodel/new, create/create, delete/delete, delete/delete_redir, delete/delete_redir2, delete/event, delete/flow-delete-post, delete/flow-delete-topic, delete/flow-restore-post, delete/flow-restore-topic, delete/restore, delete/revision, gblblock/*, gblblock/gunblock, gblrename/merge, gblrename/promote, gblrename/rename, gblrights/deleteset, gblrights/groupperms, gblrights/groupprms2, gblrights/groupprms3, gblrights/grouprename, gblrights/newset, gblrights/setchange, gblrights/setnewtype, gblrights/setrename, gblrights/usergroups, globalauth/delete, globalauth/hide, globalauth/lock, globalauth/lockandhid, globalauth/setstatus, globalauth/unhide, globalauth/unlock, import/interwiki, import/lqt-to-flow-topic, import/translatable-bundle, import/upload, interwiki/iw_add, interwiki/iw_delete, interwiki/iw_edit, ipinfo/*, liquidthreads/merge, liquidthreads/move, liquidthreads/resort, liquidthreads/signatureedit, liquidthreads/split, liquidthreads/subjectedit, lock/flow-lock-topic, lock/flow-restore-topic, managetags/activate, managetags/create, managetags/deactivate, managetags/delete, massmessage/*, massmessage/failure, massmessage/send, massmessage/skipbadns, massmessage/skipnouser, massmessage/skipoptout, merge/merge, merge/merge-into, messagebundle/deletefnok, messagebundle/deletefok, messagebundle/movenok, messagebundle/moveok, move/move, move/move_redir, newsletter/*, newusers/autocreate, newusers/byemail, newusers/create, newusers/create2, newusers/forcecreatelocal, newusers/newusers, notifytranslators/sent, oath/*, pagelang/pagelang, pagetranslation/associate, pagetranslation/deletefnok, pagetranslation/deletefok, pagetranslation/deletelnok, pagetranslation/deletelok, pagetranslation/discourage, pagetranslation/dissociate, pagetranslation/encourage, pagetranslation/mark, pagetranslation/movenok, pagetranslation/moveok, pagetranslation/prioritylanguages, pagetranslation/unmark, patrol/autopatrol, patrol/patrol, protect/modify, protect/move_prot, protect/protect, protect/unprotect, renameuser/renameuser, rights/autopromote, rights/blockautopromote, rights/restoreautopromote, rights/rights, spamblacklist/*, suppress/block, suppress/cadelete, suppress/delete, suppress/event, suppress/flow-restore-post, suppress/flow-restore-topic, suppress/flow-suppress-post, suppress/flow-suppress-topic, suppress/hide-afl, suppress/reblock, suppress/revision, suppress/setstatus, suppress/unhide-afl, tag/update, thanks/*, timedmediahandler/resettranscode, titleblacklist/*, translationreview/group, translationreview/message, translationreview/unfuzzy, upload/overwrite, upload/revert, upload/upload, urlshortener/*, usermerge/*
- lestart
The timestamp to start enumerating from.
- Type: timestamp (allowed formats)
- leend
The timestamp to end enumerating.
- Type: timestamp (allowed formats)
- ledir
In which direction to enumerate:
- newer
- List oldest first. Note: lestart has to be before leend.
- older
- List newest first (default). Note: lestart has to be later than leend.
- One of the following values: newer, older
- Default: older
- leuser
Filter entries to those made by the given user.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- letitle
Filter entries to those related to a page.
- lenamespace
Filter entries to those in the given namespace.
- One of the following values: -1, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- leprefix
Disabled due to miser mode.
- letag
Only list event entries tagged with this tag.
- lelimit
How many total event entries to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- lecontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- List recent log events.
- api.php?action=query&list=logevents [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"continue": "-||",
"lecontinue": "20190606150600|99729503"
},
"query": {
"logevents": [
{
"action": "create",
"comment": "added to WikiProject (via [[WP:JWB]])",
"logid": 99729506,
"logpage": 60974819,
"ns": 15,
"pageid": 60974819,
"params": {},
"timestamp": "2019-06-06T15:06:07Z",
"title": "Category talk:Electronic albums by Senegalese artists",
"type": "create",
"user": "Jevansen"
}
...
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
leparam_user | User name username not found. |
leparam_title | Bad title "title". This happens when you set letitle to an invalid title. |
apierror-unrecognizedvalue | Unrecognized value for parameter leaction: value. |
apierror-prefixsearchdisabled | Prefix search is disabled in Miser Mode. |
Parameter history
- v1.17: Introduced
leaction
Additional notes
- This module cannot be used as a generator .
- For autoblock unblock entries, the
title
returned is shown as "User:$blockid". This is not a userpage, but just the way it is stored. See T19781. - When
userid
is specified for account creation events, theuserid
of the creating user is returned. When absent, theuserid
returned is that of the created account. See T73020. - See Manual:Log actions for log types and log actions, and their log parameters and log_search entries and descriptions.
- Every log action is logged in the Manual:Logging table . Users can see those edits on Special:Log, except for a few restricted logs like Special:Log/suppress.
See also
- API:Recentchanges - Gets a list of all recent changes.
- API:Database field and API property associations .
Protectedtitles
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.15 |
GET request to list titles protected from creation.
This module can be used as a generator .
API documentation
![]() | The following documentation is the output of Special: |
list=protectedtitles (pt)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
List all titles protected from creation.
- ptnamespace
Only list titles in these namespaces.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- ptlevel
Only list titles with these protection levels.
- Values (separate with | or alternative): autoconfirmed, sysop
- ptlimit
How many total pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- ptdir
In which direction to enumerate:
- newer
- List oldest first. Note: ptstart has to be before ptend.
- older
- List newest first (default). Note: ptstart has to be later than ptend.
- One of the following values: newer, older
- Default: older
- ptstart
Start listing at this protection timestamp.
- Type: timestamp (allowed formats)
- ptend
Stop listing at this protection timestamp.
- Type: timestamp (allowed formats)
- ptprop
Which properties to get:
- timestamp
- Adds the timestamp of when protection was added.
- user
- Adds the user that added the protection.
- userid
- Adds the user ID that added the protection.
- comment
- Adds the comment for the protection.
- parsedcomment
- Adds the parsed comment for the protection.
- expiry
- Adds the timestamp of when the protection will be lifted.
- level
- Adds the protection level.
- Values (separate with | or alternative): comment, expiry, level, parsedcomment, timestamp, user, userid
- Default: timestamp|level
- ptcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- List protected titles.
- api.php?action=query&list=protectedtitles [open in sandbox]
- Find links to protected titles in the main namespace.
- api.php?action=query&generator=protectedtitles&gptnamespace=0&prop=linkshere [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"ptcontinue": "20190520051937|118|Dj_Consequence",
"continue": "-||"
},
"query": {
"protectedtitles": [
{
"ns": 118,
"title": "Draft:DJ Consequence",
"timestamp": "2019-05-20T05:34:39Z",
"level": "sysop"
},
{
"ns": 0,
"title": "DJ Consequence",
"timestamp": "2019-05-20T05:20:31Z",
"level": "sysop"
}
]
}
}
Sample code
Parameter history
- v1.23: Introduced
continue
- v1.17: Introduced
userid
- v1.16: Introduced
parsedcomment
See also
- API:Protect - Change a page's protection level.
Querypage
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.18 |
GET request to get a list provided by a QueryPage-based special page.
API documentation
![]() | The following documentation is the output of Special: |
list=querypage (qp)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Get a list provided by a QueryPage-based special page.
- qppage
The name of the special page. Note, this is case-sensitive.
- This parameter is required.
- One of the following values: Ancientpages, BrokenRedirects, Deadendpages, DisambiguationPageLinks, DisambiguationPages, DoubleRedirects, Fewestrevisions, GadgetUsage, GloballyWantedFiles, ListDuplicatedFiles, Listredirects, Lonelypages, Longpages, MediaStatistics, MostGloballyLinkedFiles, Mostcategories, Mostimages, Mostinterwikis, Mostlinked, Mostlinkedcategories, Mostlinkedtemplates, Mostrevisions, OrphanedTimedText, Shortpages, Uncategorizedcategories, Uncategorizedimages, Uncategorizedpages, Uncategorizedtemplates, UnconnectedPages, Unusedcategories, Unusedimages, Unusedtemplates, Unwatchedpages, Wantedcategories, Wantedfiles, Wantedpages, Wantedtemplates, Withoutinterwiki
- qpoffset
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- Type: integer
- Default: 0
- qplimit
Number of results to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"continue": "-||",
"qpoffset": 10
},
"query": {
"querypage": {
"cached": "",
"cachedtimestamp": "2019-02-22T11:46:48Z",
"maxresults": 5000,
"name": "Uncategorizedpages",
"results": [
{
"ns": 0,
"title": "Abelardo Delgado",
"value": "0"
},
{
"ns": 0,
"title": "Agriculture in Tonga",
"value": "0"
},
{
"ns": 0,
"title": "Andriandramaka",
"value": "0"
}
...
]
}
}
}
Sample code
Special page values
(MediaWiki 1.32.0)
Ancientpages | Listredirects | Mostlinked | Unusedtemplates |
BrokenRedirects | Lonelypages | Mostrevisions | Unwatchedpages |
Deadendpages | Longpages | Shortpages | Wantedcategories |
DisambiguationPageLinks | MediaStatistics | Uncategorizedcategories | Wantedfiles |
DisambiguationPages | Mostcategories | Uncategorizedpages | Wantedpages |
DoubleRedirects | MostGloballyLinkedFiles | Uncategorizedimages | Wantedtemplates |
EntityUsage | Mostimages | Uncategorizedtemplates | Withoutinterwiki |
Fewestrevisions | Mostinterwikis | UnconnectedPages | |
GloballyWantedFiles | Mostlinkedcategories | Unusedcategories | |
ListDuplicatedFiles | Mostlinkedtemplates | Unusedimages |
Possible errors
Code | Info |
---|---|
unknown_qppage | Unrecognized value for parameter qppage: value. |
noqppage | The qppage parameter must be set. |
Additional notes
- This module can be used as a generator .
- Namespace filtering is unavailable on these pages. The possible way is to manually filter "ns" from collected results.
See also
- API:Allpages - Lists all pages fitting certain criteria, within a given Namespace .
- API:Categorymembers - Lists all pages within a category
- API:Pageswithprop - List all pages using a given page property.
Random
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.12 |
GET request to view a list of random pages.
This module can be used as a generator .
API documentation
![]() | The following documentation is the output of Special: |
list=random (rn)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Get a set of random pages.
Pages are listed in a fixed sequence, only the starting point is random. This means that if, for example, Main Page is the first random page in the list, List of fictional monkeys will always be second, List of people on stamps of Vanuatu third, etc.
- rnnamespace
Return pages in these namespaces only.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- rnfilterredir
How to filter for redirects.
- One of the following values: all, nonredirects, redirects
- Default: nonredirects
- rnminsize
Limit to pages with at least this many bytes.
- Type: integer
- rnmaxsize
Limit to pages with at most this many bytes.
- Type: integer
- rncontentmodel
Filter pages that have the specified content model.
- One of the following values: GadgetDefinition, Json.JsonConfig, JsonSchema, MassMessageListContent, NewsletterContent, Scribunto, SecurePoll, css, flow-board, javascript, json, sanitized-css, text, translate-messagebundle, unknown, vue, wikitext
- rnredirect
- Deprecated.
Use rnfilterredir=redirects instead.
- Type: boolean (details)
- rnlimit
Limit how many random pages will be returned.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 1
- rncontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- Return two random pages from the main namespace.
- api.php?action=query&list=random&rnnamespace=0&rnlimit=2 [open in sandbox]
- Return page info about two random pages from the main namespace.
- api.php?action=query&generator=random&grnnamespace=0&grnlimit=2&prop=info [open in sandbox]
- Return page info about one random page from the main namespace that has at least 500 bytes of text.
- api.php?action=query&list=random&rnnamespace=0&rnlimit=1&minsize=500 [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"rncontinue": "0.559881820010|0.559881954661|47659388|0",
"continue": "-||"
},
"query": {
"random": [
{
"id": 32381675,
"ns": 0,
"title": "Mallabhum Institute of Technology"
},
{
"id": 25126452,
"ns": 3,
"title": "User talk:96.232.132.176"
},
{
"id": 1440028,
"ns": 0,
"title": "Hyundai Epsilon engine"
},
{
"id": 35446805,
"ns": 15,
"title": "Category talk:Ukrainian card games"
},
{
"id": 12613,
"ns": 0,
"title": "Grue"
}
]
}
}
Sample code
Parameter history
- v1.26: Previous limit of 10/20 on
rnlimit
was increased to standard 500/5000 limits. - v1.26: Deprecated
rnredirect
- v1.26: Introduced
rnfilterredir
- v1.14: Introduced
rnredirect
Additional notes
- Unlike most modules in the Action API , the default number of pages returned is 1, not 10.
- Pages are returned in a fixed sequence; only the starting point is actually random.
- The default behavior is to pick pages from across the entire wiki, including talk pages, user pages, and so on. If you are looking for similar functionality as Special:Random, i.e. pick random articles, restrict
rnnamespace
to0
. - If the number of pages is fewer than
rnlimit
, the request will simply return all available pages. It will not repeat pages to pad out the response up to the limit.
See also
- Manual:Random page - describes how to configure the API on the backend. Category:Random page
RecentChanges
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.9 |
GET request to list all the recent changes to the wiki, in the same manner as Special:RecentChanges lists them.
API documentation
![]() | The following documentation is the output of Special: |
list=recentchanges (rc)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Enumerate recent changes.
- rcstart
The timestamp to start enumerating from.
- Type: timestamp (allowed formats)
- rcend
The timestamp to end enumerating.
- Type: timestamp (allowed formats)
- rcdir
In which direction to enumerate:
- newer
- List oldest first. Note: rcstart has to be before rcend.
- older
- List newest first (default). Note: rcstart has to be later than rcend.
- One of the following values: newer, older
- Default: older
- rcnamespace
Filter changes to only these namespaces.
- Values (separate with | or alternative): -1, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- rcuser
Only list changes by this user.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- rcexcludeuser
Don't list changes by this user.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- rctag
Only list changes tagged with this tag.
- rcprop
Include additional pieces of information:
- user
- Adds the user responsible for the edit and tags if they are an IP. If the user has been revision deleted, a userhidden property will be returned.
- userid
- Adds the user ID responsible for the edit. If the user has been revision deleted, a userhidden property will be returned.
- comment
- Adds the comment for the edit. If the comment has been revision deleted, a commenthidden property will be returned.
- parsedcomment
- Adds the parsed comment for the edit. If the comment has been revision deleted, a commenthidden property will be returned.
- flags
- Adds flags for the edit.
- timestamp
- Adds timestamp of the edit.
- title
- Adds the page title of the edit.
- ids
- Adds the page ID, recent changes ID and the new and old revision ID.
- sizes
- Adds the new and old page length in bytes.
- redirect
- Tags edit if page is a redirect.
- patrolled
- Tags patrollable edits as being patrolled or unpatrolled.
- loginfo
- Adds log information (log ID, log type, etc) to log entries.
- tags
- Lists tags for the entry.
- sha1
- Adds the content checksum for entries associated with a revision. If the content has been revision deleted, a sha1hidden property will be returned.
- Values (separate with | or alternative): comment, flags, ids, loginfo, parsedcomment, patrolled, redirect, sha1, sizes, tags, timestamp, title, user, userid
- Default: title|timestamp|ids
- rcshow
Show only items that meet these criteria. For example, to see only minor edits done by logged-in users, set rcshow=minor|!anon.
- Values (separate with | or alternative): !anon, !autopatrolled, !bot, !minor, !patrolled, !redirect, anon, autopatrolled, bot, minor, patrolled, redirect, unpatrolled
- rclimit
How many total changes to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- rctype
Which types of changes to show.
- Values (separate with | or alternative): categorize, edit, external, log, new
- Default: edit|new|log|categorize
- rctoponly
Only list changes which are the latest revision.
- Type: boolean (details)
- rctitle
Filter entries to those related to a page.
- rccontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- rcgeneraterevisions
When being used as a generator, generate revision IDs rather than titles. Recent change entries without associated revision IDs (e.g. most log entries) will generate nothing.
- Type: boolean (details)
- rcslot
Only list changes that touch the named slot.
- One of the following values: main
- List recent changes.
- api.php?action=query&list=recentchanges [open in sandbox]
- Get page info about recent unpatrolled changes.
- api.php?action=query&generator=recentchanges&grcshow=!patrolled&prop=info [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"rccontinue": "20180330090522|1041353210",
"continue": "-||"
},
"query": {
"recentchanges": [
{
"type": "edit",
"ns": 0,
"title": "Histology",
"pageid": 13570,
"revid": 833218500,
"old_revid": 833218201,
"rcid": 1041353213,
"user": "Iztwoz",
"oldlen": 25718,
"newlen": 25749
}
...
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
rcshow | Incorrect parameter - mutually exclusive values may not be supplied. |
rcpermissiondenied | You need the patrol or patrolmarks right to request the patrolled flag. |
Parameter history
- v1.24: Deprecated
rctoken
- v1.15: Removed
rctitles
- v1.14: Introduced
rctitles
- v1.13: Introduced
loginfo
Additional notes
- Many log actions can be viewed using this module excluding patrol actions as they are not present in the recentchanges table.
- The Timestamp to start listing from may not be more than $wgRCMaxAge into the past, which on Wikimedia wikis is 30 days.
- New changes may be inserted to the
recentchanges
table slightly out of order with respect to their timestamp. Thus, when requesting the most recent changes twice in a row, the second response may contain new changes inserted a few seconds before the most recent one in the first response. If you repeatedly call this module to get a stream a recent change, consider adding some overlap between requests to not miss any changes. - This module can be used as a generator.
- This module is implemented by ApiQueryRecentChanges.php .
See also
Search
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.11 |
GET request to perform an advanced search for wiki pages by title or content text match.
API documentation
![]() | The following documentation is the output of Special: |
list=search (sr)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Perform a full text search.
- srsearch
Search for page titles or content matching this value. You can use the search string to invoke special search features, depending on what the wiki's search backend implements.
- This parameter is required.
- srnamespace
Search only within these namespaces.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- Default: 0
- srlimit
How many total pages to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- sroffset
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- Type: integer
- The value must be no less than 0.
- Default: 0
- srqiprofile
Query independent profile to use (affects ranking algorithm).
- classic
- Ranking based on the number of incoming links, some templates, page language and recency (templates/language/recency may not be activated on this wiki).
- classic_noboostlinks
- Ranking based on some templates, page language and recency when activated on this wiki.
- empty
- Ranking based solely on query dependent features (for debug only).
- wsum_inclinks
- Weighted sum based on incoming links
- wsum_inclinks_pv
- Weighted sum based on incoming links and weekly pageviews
- popular_inclinks_pv
- Ranking based primarily on page views
- popular_inclinks
- Ranking based primarily on incoming link counts
- engine_autoselect
- Let the search engine decide on the best profile to use.
- One of the following values: classic, classic_noboostlinks, empty, engine_autoselect, popular_inclinks, popular_inclinks_pv, wsum_inclinks, wsum_inclinks_pv
- Default: engine_autoselect
- srwhat
Which type of search to perform.
- One of the following values: nearmatch, text, title
- srinfo
Which metadata to return.
- Values (separate with | or alternative): rewrittenquery, suggestion, totalhits
- Default: totalhits|suggestion|rewrittenquery
- srprop
Which properties to return:
- size
- Adds the size of the page in bytes.
- wordcount
- Adds the word count of the page.
- timestamp
- Adds the timestamp of when the page was last edited.
- snippet
- Adds a snippet of the page, with query term highlighting markup.
- titlesnippet
- Adds the page title, with query term highlighting markup.
- redirecttitle
- Adds the title of the matching redirect.
- redirectsnippet
- Adds the title of the matching redirect, with query term highlighting markup.
- sectiontitle
- Adds the title of the matching section.
- sectionsnippet
- Adds the title of the matching section, with query term highlighting markup.
- isfilematch
- Adds a boolean indicating if the search matched file content.
- categorysnippet
- Adds the matching category name, with query term highlighting markup.
- score
- Deprecated. Ignored.
- hasrelated
- Deprecated. Ignored.
- extensiondata
- Adds extra data generated by extensions.
- Values (separate with | or alternative): categorysnippet, extensiondata, isfilematch, redirectsnippet, redirecttitle, sectionsnippet, sectiontitle, size, snippet, timestamp, titlesnippet, wordcount, hasrelated, score
- Default: size|wordcount|timestamp|snippet
- srinterwiki
Include interwiki results in the search, if available.
- Type: boolean (details)
- srenablerewrites
Enable internal query rewriting. Some search backends can rewrite the query into another which is thought to provide better results, for instance by correcting spelling errors.
- Type: boolean (details)
- srsort
Set the sort order of returned results.
- One of the following values: create_timestamp_asc, create_timestamp_desc, incoming_links_asc, incoming_links_desc, just_match, last_edit_asc, last_edit_desc, none, random, relevance, user_random
- Default: relevance
- Search for meaning.
- api.php?action=query&list=search&srsearch=meaning [open in sandbox]
- Search texts for meaning.
- api.php?action=query&list=search&srwhat=text&srsearch=meaning [open in sandbox]
- Get page info about the pages returned for a search for meaning.
- api.php?action=query&generator=search&gsrsearch=meaning&prop=info [open in sandbox]
GET request
utf8
in the get request above to see the difference.Response
{
"batchcomplete": "",
"continue": {
"sroffset": 10,
"continue": "-||"
},
"query": {
"searchinfo": {
"totalhits": 5060
},
"search": [
{
"ns": 0,
"title": "Nelson Mandela",
"pageid": 21492751,
"size": 196026,
"wordcount": 23664,
"snippet": "<span class=\"searchmatch\">Nelson</span> Rolihlahla <span class=\"searchmatch\">Mandela</span> (/mænˈdɛlə/, Xhosa: [xoliɬaˈɬa <span class=\"searchmatch\">manˈdɛla</span>]; 18 July 1918 – 5 December 2013) was a South African anti-apartheid revolutionary,",
"timestamp": "2018-07-23T07:59:43Z"
},
{
"ns": 0,
"title": "Death of Nelson Mandela",
"pageid": 41284488,
"size": 133513,
"wordcount": 13512,
"snippet": "On December 5, 2013, <span class=\"searchmatch\">Nelson</span> <span class=\"searchmatch\">Mandela</span>, the first President of South Africa to be elected in a fully representative democratic election, as well as the country's",
"timestamp": "2018-07-19T17:30:59Z"
}
...
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
nosrsearch | The srsearch parameter must be set. This was param-search before 1.17 |
search-text-disabled | text search is disabled. |
search-title-disabled | title search is disabled. |
search-error | search error has occurred |
Parameter history
- v1.24: Deprecated
score
,hasrelated
- v1.23:
- Removed
srredirects
. Redirects are always included. - Introduced
srinterwiki
- Removed
- v1.22: Introduced
srbackend
- v1.17: Introduced
nearmatch
,score
,titlesnippet
,redirecttitle
,redirectsnippet
,sectiontitle
,sectionsnippet
,hasrelated
- v1.16: Introduced
srinfo
,srprop
Additional notes
- Depending on which search backend is in use, how
srsearch
is interpreted may vary. On Wikimedia wikis which use CirrusSearch, see Help:CirrusSearch for information about the search syntax.
See also
Tags
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.16 |
GET request to list valid change tags.
API documentation
![]() | The following documentation is the output of Special: |
list=tags (tg)
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
List change tags.
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
The maximum number of tags to list.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
Which properties to get:
- displayname
- Adds system message for the tag.
- description
- Adds description of the tag.
- hitcount
- Adds the number of revisions and log entries that have this tag.
- defined
- Indicate whether the tag is defined.
- source
- Gets the sources of the tag, which may include extension for extension-defined tags and manual for tags that may be applied manually by users.
- active
- Whether the tag is still being applied.
- Values (separate with | or alternative): active, defined, description, displayname, hitcount, source
- Default: (empty)
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"continue": "-||",
"tgcontinue": "Extraneous formatting"
},
"query": {
"tags": [
{
"hitcount": 2481517,
"name": "AWB"
},
{
"hitcount": 10849,
"name": "Addition of interwiki link"
},
{
"hitcount": 819,
"name": "Citing predatory open access journal"
}
]
}
}
Sample code
Additional notes
- This module cannot be used as a Generator .
See also
- API:Recentchanges - List recent changes
- API:Managetags - Define or delete tags
Usercontribs
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.9 |
GET request to list a user's contributions.
API documentation
![]() | The following documentation is the output of Special: |
list=usercontribs (uc)
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
Get all edits by a user.
- uclimit
The maximum number of contributions to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- ucstart
The start timestamp to return from, i.e. revisions before this timestamp.
- Type: timestamp (allowed formats)
- ucend
The end timestamp to return to, i.e. revisions after this timestamp.
- Type: timestamp (allowed formats)
- uccontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- ucuser
The users to retrieve contributions for. Cannot be used with ucuserids, ucuserprefix, or uciprange.
- Type: list of users, by any of username, IP, Temporary user and interwiki name (e.g. "prefix>ExampleName")
- Separate values with | or alternative.
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- ucuserids
The user IDs to retrieve contributions for. Cannot be used with ucuser, ucuserprefix, or uciprange.
- Type: list of integers
- Separate values with | or alternative.
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- ucuserprefix
Retrieve contributions for all users whose names begin with this value. Cannot be used with ucuser, ucuserids, or uciprange.
- uciprange
The CIDR range to retrieve contributions for. Cannot be used with ucuser, ucuserprefix, or ucuserids.
- ucdir
In which direction to enumerate:
- newer
- List oldest first. Note: ucstart has to be before ucend.
- older
- List newest first (default). Note: ucstart has to be later than ucend.
- One of the following values: newer, older
- Default: older
- ucnamespace
Only list contributions in these namespaces.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- ucprop
Include additional pieces of information:
- ids
- Adds the page ID and revision ID.
- title
- Adds the title and namespace ID of the page.
- timestamp
- Adds the timestamp of the edit.
- comment
- Adds the comment of the edit. If the comment has been revision deleted, a commenthidden property will be returned.
- parsedcomment
- Adds the parsed comment of the edit. If the comment has been revision deleted, a commenthidden property will be returned.
- size
- Adds the new size of the edit.
- sizediff
- Adds the size delta of the edit against its parent.
- flags
- Adds flags of the edit.
- patrolled
- Tags patrolled edits.
- tags
- Lists tags for the edit.
- Values (separate with | or alternative): comment, flags, ids, parsedcomment, patrolled, size, sizediff, tags, timestamp, title
- Default: ids|title|timestamp|comment|size|flags
- ucshow
Show only items that meet these criteria, e.g. non minor edits only: ucshow=!minor.
If ucshow=patrolled or ucshow=!patrolled is set, revisions older than $wgRCMaxAge (2592000 seconds) won't be shown.
- Values (separate with | or alternative): !autopatrolled, !minor, !new, !patrolled, !top, autopatrolled, minor, new, patrolled, top
- uctag
Only list revisions tagged with this tag.
- uctoponly
- Deprecated.
Only list changes which are the latest revision.
- Type: boolean (details)
- Show contributions of user Example.
- api.php?action=query&list=usercontribs&ucuser=Example [open in sandbox]
- Show contributions from all IP addresses with prefix 192.0.2..
- api.php?action=query&list=usercontribs&ucuserprefix=192.0.2. [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"uccontinue": "20190130180447|880978627",
"continue": "-||"
},
"query": {
"usercontribs": [
{
"userid": 24,
"user": "Jimbo Wales",
"pageid": 9870625,
"revid": 881893498,
"parentid": 881892978,
"ns": 3,
"title": "User talk:Jimbo Wales",
"timestamp": "2019-02-05T14:05:11Z",
"comment": "/* Fancy I edit Wikipedia T-Shirt */",
"size": 29753
},
{
"userid": 24,
"user": "Jimbo Wales",
"pageid": 9870625,
"revid": 881282261,
"parentid": 881270759,
"ns": 3,
"title": "User talk:Jimbo Wales",
"timestamp": "2019-02-01T15:29:31Z",
"comment": "/* Macedonian President Gorge Ivanov is now in the House arrest */",
"size": 60166
},
{
"userid": 24,
"user": "Jimbo Wales",
"pageid": 9513191,
"revid": 881245934,
"parentid": 881240310,
"ns": 1,
"title": "Talk:Mark Dice",
"timestamp": "2019-02-01T09:48:38Z",
"comment": "/* So good they names it twice */",
"size": 74128
},
...
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
invaliduserid | User ID username is not valid. |
paramempty_ucuser | The parameter user may not be empty. |
baduser_ucuser | Invalid value "username" for user parameter user. |
show | Incorrect parameter - mutually exclusive values may not be supplied. |
permissiondenied | You need the patrol or patrolmarks right to request the patrolled flag. |
Parameter history
- v1.39: Introduced
uciprange
- v1.29: Introduced
ucuserids
- v1.23: Deprecated
uctoponly
- v1.23: Introduced
ucshow=top
,ucshow=!top
,ucshow=new
,ucshow=!new
- v1.20: Introduced
ucprop=sizediff
- v1.18: Introduced
uctoponly
- v1.16: Introduced
ucprop=parsedcomment
,ucprop=size
,ucprop=tags
,uctag
- v1.15: Introduced
ucprop=patrolled
,ucshow=patrolled
,ucshow=!patrolled
- v1.14: Introduced
uccontinue
- v1.13: Introduced
ucuserprefix
- v1.11: Introduced
ucnamespace
,ucprop
,ucshow
Additional notes
- The module returns page edits and moves, but not other operations, such as uploads.
- Prior to MediaWiki v1.14, the
start
parameter was used to view additional results within the response. Between v1.14 and v1.22,start
was used to continue when listing a single user's contributions;continue
was used when listing contributions from multiple users. From v1.23 forwards, all queries usecontinue
.
See also
- API:Logevents - shows many kinds of user activity, including uploads Category:MediaWiki API query lists
Users
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.12 |
GET request to view information about a list of users.
API documentation
![]() | The following documentation is the output of Special: |
list=users (us)
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
Get information about a list of users.
- usprop
Which pieces of information to include:
- blockinfo
- Tags if the user is blocked, by whom, and for what reason.
- groups
- Lists all the groups each user belongs to.
- groupmemberships
- Lists groups that each user has been explicitly assigned to, including the expiry date of each group membership.
- implicitgroups
- Lists all the groups a user is automatically a member of.
- rights
- Lists all the rights each user has.
- editcount
- Adds the user's edit count.
- registration
- Adds the user's registration timestamp.
- emailable
- Tags if the user can and wants to receive email through Special:Emailuser.
- gender
- Tags the gender of the user. Returns "male", "female", or "unknown".
- centralids
- Adds the central IDs and attachment status for the user.
- cancreate
- Indicates whether an account for valid but unregistered usernames can be created. To check whether the current user can perform the account creation, use action=query&meta=userinfo&uiprop=cancreateaccount.
- Values (separate with | or alternative): blockinfo, cancreate, centralids, editcount, emailable, gender, groupmemberships, groups, implicitgroups, registration, rights
- usattachedwiki
With usprop=centralids, indicate whether the user is attached with the wiki identified by this ID.
- ususers
A list of users to obtain information for.
- Separate values with | or alternative.
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- ususerids
A list of user IDs to obtain information for.
- Type: list of integers
- Separate values with | or alternative.
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- Return information for user Example.
- api.php?action=query&list=users&ususers=Example&usprop=groups|editcount|gender [open in sandbox]
Example
GET request
usprop
parameterResponse
{
"batchcomplete": "",
"query": {
"users": [
{
"name": "1.2.3.4",
"invalid": ""
},
{
"userid": 4587601,
"name": "Catrope",
"editcount": 359,
"registration": "2007-06-07T16:36:03Z",
"groups": [
"*",
"user",
"autoconfirmed"
],
"emailable": "",
"gender": "male"
},
{
"name": "Vandal01",
"missing": ""
},
{
"userid": 2793024,
"name": "Bob",
"editcount": 4542,
"registration": "2006-11-18T21:55:03Z",
"groups": [
"extendedconfirmed",
"reviewer",
"*",
"user",
"autoconfirmed"
],
"emailable": "",
"gender": "male"
}
]
}
}
Sample code
Parameter history
- v1.29: Introduced
ususerids
,userrights
- v1.24: Deprecated
ustoken
- v1.18: Introduced
implicitgroups
- v1.17: Introduced
rights
- v1.16: Introduced
ususerids
,gender
- v1.14: Introduced
emailable
- v1.13: Introduced
registration
See also
- Help:User rights and groups - More information on user rights, and how they relate to groups
- API:User group membership - Adding and removing users from groups
- API:Allusers - Lists registered users in alphabetical order
- Extension:CentralAuth/API - Global user info
Watchlist
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.9 |
GET request to list pages on the current user's watchlist that were changed within the given time period, ordered by time of the last change of the watched page.
This module can be used as a generator .
API documentation
![]() | The following documentation is the output of Special: |
list=watchlist (wl)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Get recent changes to pages in the current user's watchlist.
- wlallrev
Include multiple revisions of the same page within given timeframe.
- Type: boolean (details)
- wlstart
The timestamp to start enumerating from.
- Type: timestamp (allowed formats)
- wlend
The timestamp to end enumerating.
- Type: timestamp (allowed formats)
- wlnamespace
Filter changes to only the given namespaces.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- wluser
Only list changes by this user.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- wlexcludeuser
Don't list changes by this user.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- wldir
In which direction to enumerate:
- newer
- List oldest first. Note: wlstart has to be before wlend.
- older
- List newest first (default). Note: wlstart has to be later than wlend.
- One of the following values: newer, older
- Default: older
- wllimit
How many total results to return per request.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- wlprop
Which additional properties to get:
- ids
- Adds revision IDs and page IDs.
- title
- Adds title of the page.
- flags
- Adds flags for the edit.
- user
- Adds the user who made the edit. If the user has been revision deleted, a userhidden property will be returned.
- userid
- Adds user ID of whoever made the edit. If the user has been revision deleted, a userhidden property will be returned.
- comment
- Adds comment of the edit. If the comment has been revision deleted, a commenthidden property will be returned.
- parsedcomment
- Adds parsed comment of the edit. If the comment has been revision deleted, a commenthidden property will be returned.
- timestamp
- Adds timestamp of the edit.
- patrol
- Tags edits that are patrolled.
- sizes
- Adds the old and new lengths of the page.
- notificationtimestamp
- Adds timestamp of when the user was last notified about the edit.
- loginfo
- Adds log information where appropriate.
- tags
- Lists tags for the entry.
- expiry
- Adds the expiry time.
- Values (separate with | or alternative): comment, expiry, flags, ids, loginfo, notificationtimestamp, parsedcomment, patrol, sizes, tags, timestamp, title, user, userid
- Default: ids|title|flags
- wlshow
Show only items that meet these criteria. For example, to see only minor edits done by logged-in users, set wlshow=minor|!anon.
- Values (separate with | or alternative): !anon, !autopatrolled, !bot, !minor, !patrolled, !unread, anon, autopatrolled, bot, minor, patrolled, unread
- wltype
Which types of changes to show:
- edit
- Regular page edits.
- new
- Page creations.
- log
- Log entries.
- external
- External changes.
- categorize
- Category membership changes.
- Values (separate with | or alternative): categorize, edit, external, log, new
- Default: edit|new|log|categorize
- wlowner
Used along with wltoken to access a different user's watchlist.
- Type: user, by username
- wltoken
A security token (available in the user's preferences) to allow access to another user's watchlist.
- wlcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- List the top revision for recently changed pages on the current user's watchlist.
- api.php?action=query&list=watchlist [open in sandbox]
- Fetch additional information about the top revision for recently changed pages on the current user's watchlist.
- api.php?action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment [open in sandbox]
- Fetch additional information about the top revision for recently changed pages on the current user's watchlist, including when temporarily watched items will expire.
- api.php?action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment|expiry [open in sandbox]
- Fetch information about all recent changes to pages on the current user's watchlist.
- api.php?action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment [open in sandbox]
- Fetch page info for recently changed pages on the current user's watchlist.
- api.php?action=query&generator=watchlist&prop=info [open in sandbox]
- Fetch revision info for recent changes to pages on the current user's watchlist.
- api.php?action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user [open in sandbox]
- List the top revision for recently changed pages on the watchlist of user Example.
- api.php?action=query&list=watchlist&wlowner=Example&wltoken=123ABC [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"query": {
"watchlist": [
{
"ns": 1,
"old_revid": 898447862,
"pageid": 5858,
"revid": 898447924,
"title": "Talk:Software",
"type": "edit"
},
{
"ns": 0,
"old_revid": 896386764,
"pageid": 18934886,
"revid": 897854521,
"title": "Proprietary software",
"type": "edit"
},
{
"minor": "",
"ns": 0,
"old_revid": 894771707,
"pageid": 1721496,
"revid": 897348916,
"title": "Free and open-source software",
"type": "edit"
}
]
}
}
Sample code
Possible errors
Code | Info |
---|---|
wlnotloggedin | You must be logged-in to have a watchlist |
wlpatrol | patrol property is not available |
wlshow | Incorrect parameter - mutually exclusive values may not be supplied. |
Parameter history
- v1.24: Introduced
unread
,!unread
- v1.23: Introduced
wlcontinue
- v1.22: Introduced
wltype
- v1.18: Introduced
loginfo
- v1.17: Introduced
userid
- v1.16: Introduced
wluser
,wlexcludeuser
,parsedcomment
,notificationtimestamp
,wlowner
,wltoken
- v1.14: Introduced
patrolled
,!patrolled
- v1.12: Introduced
wlshow
- v1.11: Introduced
ids
,title
,flags
,sizes
Additional Notes
- This module should not be confused with API:Watchlistraw , which lists all the pages on the logged in user's watchlist, regardless of whether they were recently changed or not.
See also
- API:Watch - Edit the watchlist.
- API:Watchlistraw - Get all the pages on the logged in user's watchlist, regardless of whether they were recently changed or not.
- API:Watchlist feed - Get the RSS feed of a user's watchlist.
Watchlistraw
![]() | This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.14 |
GET request to list all the pages on the logged in user's watchlist, regardless of whether they were recently changed or not.
This module can be used as a generator.
API documentation
![]() | The following documentation is the output of Special: |
list=watchlistraw (wr)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Get all pages on the current user's watchlist.
- wrcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- wrnamespace
Only list pages in the given namespaces.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- wrlimit
How many total results to return per request.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- wrprop
Which additional properties to get:
- changed
- Adds timestamp of when the user was last notified about the edit.
- Values (separate with | or alternative): changed
- wrshow
Only list items that meet these criteria.
- Values (separate with | or alternative): !changed, changed
- wrowner
Used along with wrtoken to access a different user's watchlist.
- Type: user, by username
- wrtoken
A security token (available in the user's preferences) to allow access to another user's watchlist.
- wrdir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
- wrfromtitle
Title (with namespace prefix) to begin enumerating from.
- wrtotitle
Title (with namespace prefix) to stop enumerating at.
- List pages on the current user's watchlist.
- api.php?action=query&list=watchlistraw [open in sandbox]
- Fetch page info for pages on the current user's watchlist.
- api.php?action=query&generator=watchlistraw&gwrshow=changed&prop=info [open in sandbox]
Example
GET request
Response
{
"batchcomplete": "",
"continue": {
"continue": "-||",
"wrcontinue": "0|Software"
},
"watchlistraw": [
{
"ns": 0,
"title": "Free and open-source software"
},
{
"ns": 0,
"title": "Free software"
},
{
"ns": 0,
"title": "Proprietary software"
}
]
}
Sample code
Possible errors
Code | Info |
---|---|
bad_wlowner | Specified user does not exist. |
bad_wltoken | Incorrect watchlist token provided. Please set a correct token in Special:Preferences. |
notloggedin | You must be logged-in to have a watchlist. |
show | Incorrect parameter - mutually exclusive values may not be supplied. |
Parameter history
- v1.20: Introduced
wrdir
- v1.17: Introduced
wrowner
,wrtoken
Additional notes
- This module should not be confused with API:Watchlist , which returns pages on the current user's watchlist that were changed within the given time period, ordered by time of the last change of the watched page.
- The results of this query module are returned as part of the
api
node, not thequery
node.
See also
- API:Watchlist - Get pages on a user's watchlist that were changed within the given time period, ordered by time of the last change of the watched page.
- API:Watchlist feed - Get the RSS feed of a user's watchlist.