Jump to content

API:Info

From mediawiki.org
Revision as of 20:57, 25 September 2015 by RobinHood70 (talk | contribs) (Parameters: Oops, fix)

Retrieves basic page information. The code implementing this is in ApiQueryInfo.php.

Parameters

inprop: Which properties to get. (Default: None.) 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 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.) 1.16+ watchers: The number of watchers, if allowed 1.21+ 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: The full (fullurl) and edit (editurl) for each page 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 incontinue: When more results are available, use this to continue.

Results

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". 1.22+ pagelanguage: The language code of the page content language (mostly $wgLanguageCode). 1.22+

Example

Get info about the en:Albert Einstein page
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.