API:Info
| Info | ||
|---|---|---|
| Get basic page information such as namespace, title, and last touched date. This module cannot be used as a Generator. |
||
| Prefix | in | |
| Required rights | none | |
| Post only? | No | |
| Generated help | Current | |
| Version added |
|
|
Retrieves basic page information. The code implementing this is in ApiQueryInfo.php.
Contents
Parameters[edit]
inprop: Which properties to get. (Default: None.) 1.11+protection: The protection level. 1.11+talkid: The page ID of the talk page for each non-talk page. 1.13+watched: Indicates whether or not the logged in user is watching the page. 1.16+watchers: The number of watchers, if allowed. 1.21+visitingwatchers: The number of watchers who have visited recent edits, if allowed. 1.27+notificationtimestamp: The watchlist notification timestamp of each page. 1.20+subjectid: The page ID of the parent page for each talk page. 1.13+url: Various URLs for the page (see results section). 1.14+readable: Whether the user can read this page. 1.14+preload: Include the text returned by EditFormPreloadText. 1.16+displaytitle: Gives the way the page title is actually displayed. 1.17+
intestactions: Whether or not the user can perform each of the given actions on this page. 1.25+intoken: Request a token to perform a data-modifying action on a page. Available tokens include:edit,delete,protect,move,block,unblock,email,import,watch. 1.11+ (Deprecated in 1.24)incontinue: When more results are available, use this to continue.
Results[edit]
This section documents only those result sections where there are numerous or non-obvious return values. Results like those for talkid or subjectid, where the meaning of each item can be readily inferred, are not listed here. Results for the Info module are contained within the page object itself (i.e., at the same level as the ns and title values).
Main result[edit]
The following properties will always be emitted, even if the page doesn't exist:
contentmodel: Which content model the page has; usually "wikitext". 1.22+pagelanguage: The language code of the page content language (mostly $wgLanguageCode). 1.22+
For existing pages, the following additional properties will be emitted, regardless of the value of inprop:
touched: Page touched timestamp. Note that this can differ from the timestamp of the last revision.lastrevid: Last revision ID.counter: If $wgDisableCounters is false, gives number of views. Otherwise, gives empty attribute. (Note that $wgDisableCounters is set to true on Wikimedia servers.) 1.11-1.25 (Removed in 1.25)length: Page size. 1.11+redirect: Whether the page is a redirect.new: Whether the page has only one revision. 1.11+
inprop=protection[edit]
Protection results include:
protection: The list of applied page protections.type: The type of restriction (seerestrictiontypesentry).level: The restriction level.expiry: When the page protection expires. Can be an ISO date or the word "infinity".source: For cascading protection, the source page causing the given page to be protected. 1.13+
restrictiontypes: Allowed restriction types for the page. This will normally be a subset of $wgRestrictionTypes, but can be customized by extensions to include other values via the TitleGetRestrictionTypes hook. 1.25+
inprop=url[edit]
Includes various URLs for the current page:
fullurl: The full URL for the page using the current protocol scheme for protocol-relative servers.editurl: The URL to use to edit the page via the traditional user interface. Uses the current protocol scheme for protocol-relative servers.canonicalurl: The canonical (non-protocol-relative) URL for the page, based on $wgCanonicalServer. 1.24+
intestactions[edit]
testactions: The list of actions that the user is allowed to take. As usual with XML, and JSON values under the original format, false values are excluded, meaning that this collection may be empty or have fewer values than were passed in the original query. Any invalid actions in the original query will be treated the same as actions the user cannot take.
intoken[edit]
actiontoken: Each token will be listed as its own property with the name of the action followed bytoken(e.g.,edittoken).starttimestamp: The current timestamp from the server. This is used to ensure there are no conflicting edits or administrative actions. 1.14+
Example[edit]
Get info about the en:Albert Einstein page
| Result |
|---|
{
"query": {
"pages": {
"736": {
"pageid": 736,
"ns": 0,
"title": "Albert Einstein",
"contentmodel": "wikitext",
"pagelanguage": "en",
"touched": "2015-09-24T18:56:08Z",
"lastrevid": 682594547,
"length": 126569,
"protection": [
{
"type": "edit",
"level": "autoconfirmed",
"expiry": "infinity"
},
{
"type": "move",
"level": "sysop",
"expiry": "infinity"
}
],
"restrictiontypes": [
"edit",
"move"
],
"talkid": 21091085
}
}
}
}
|
Determine whether you can edit, delete, or rollback the Albert Einstein page.
| Result |
|---|
{
"query": {
"pages": [
{
"pageid": 736,
"ns": 0,
"title": "Albert Einstein",
"contentmodel": "wikitext",
"pagelanguage": "en",
"touched": "2015-09-24T18:56:08Z",
"lastrevid": 682594547,
"length": 126569,
"actions": {
"edit": true,
"delete": false,
"rollback": false
}
}
]
}
}
|
Possible warnings[edit]
- Action 'action' is not allowed for the current user
- Thrown when a token is requested that the current user isn't allowed to use
- No support for special pages has been implemented
- Thrown when a special page is requested
Possible errors[edit]
None.