API:Info: Difference between revisions
Appearance
Content deleted Content added
RobinHood70 (talk | contribs) m Style fixes |
SPage (WMF) (talk | contribs) m rephrase link to source code |
||
| Line 8: | Line 8: | ||
|query=yes |
|query=yes |
||
}} |
}} |
||
Retrieves basic page information. The code |
Retrieves basic page information. The code implementing this is in <span class="plainlinks">{{git file|project=mediawiki/core|branch=HEAD|file=includes/api/ApiQueryInfo.php|text=ApiQueryInfo.php}}</span>. |
||
== Parameters == |
== Parameters == |
||
Revision as of 09:41, 7 April 2015
| 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.
Parameters
inprop: Which properties to getprotection: The protection level MW 1.11+talkid: The page ID of the talk page for each non-talk page MW 1.13+watched: Indicates whether or not the page is being watched by you. (It returns an empty string if you watch the page and the key is missing from answer if you don't watch it.) MW 1.16+watchers: The number of watchers, if allowed MW 1.21+notificationtimestamp: The watchlist notification timestamp of each page MW 1.20+subjectid: The page ID of the parent page for each talk page MW 1.13+url: The full (fullurl) and edit (editurl) for each page MW 1.14+readable: Whether the user can read this page MW 1.14+preload: Include the text returned by EditFormPreloadText. MW 1.16+displaytitle: Gives the way the page title is actually displayed MW 1.17+
intoken: Request a token to perform a data-modifying action on a page. Available tokens include:edit,delete,protect,move,block,unblock,email,import,watchincontinue: When more results are available, use this to continue- When the result is bigger than $wgAPIMaxResultSize
By default, the following properties will be listed:
pageid: page ID.ns: namespace.title: title.touched: page_touched timestamp.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.)length: page size.redirect: whether the page is a redirect.new: whether the page has only one revision.contentmodel: which content model the page has; usually "wikitext". MW 1.22+pagelanguage: the language code of the page content language (mostly $wgLanguageCode). MW 1.22+
Example
Get info about the en:Albert Einstein page
api.php? action=query& titles=Albert%20Einstein& prop=info& inprop=protection|talkid [try in ApiSandbox]
| Result |
|---|
<?xml version="1.0" encoding="utf-8"?>
<api>
<query>
<pages>
<page
pageid="736" ns="0" title="Albert Einstein"
contentmodel="wikitext" pagelanguage="en"
touched="2014-05-30T18:56:38Z" lastrevid="610513534"
counter="" length="117613" talkid="21091085">
<protection>
<pr type="aft" level="aft-reader" expiry="infinity" />
<pr type="edit" level="autoconfirmed" expiry="infinity" />
<pr type="move" level="sysop" expiry="infinity" />
</protection>
</page>
</pages>
</query>
</api>
|
Possible warnings
- Action 'action' is not allowed for the current user
- Thrown when a token is requested that the current user isn't allowed to use
- No support for special pages has been implemented
- Thrown when a special page is requested
Possible errors
None.