API:Query - Properties/es

From MediaWiki.org

Jump to: navigation, search
Esta página es parte de la documentación de la API MediaWiki, pero actualmente está traduciéndose al español. Puedes contribuir traduciéndola, o ir a una versión en alguno de los siguientes idiomas:
API de MediaWiki


Las propiedades se emplean para obtener varios datos sobre las páginas especificadas a través de los parámetros titles=, pageids= o revids=, o empleando generadores.

Contents

[edit] info / in

MediaWiki version: 1.9

Obtiene información básica de la o las páginas.

[edit] Parámetros

  • inprop: Indica qué propiedades desean obtenerse:
    • protection: El nivel de protección;
    • talkid: El identificador (ID) de la página de discusión de cada página que no sea de discusión;
    • subjectid: El identificador de la página principal de cada página de discusión.

[edit] Ejemplo

Obtiene información de la página es:Albert Einstein.

api.php ? action=query & titles=Albert%20Einstein & prop=info & inprop=protection|talkid

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query>
    <pages>
      <page
       pageid="53" ns="0" title="Albert Einstein"
       touched="2008-05-21T17:34:31Z" lastrevid="17549470"
       counter="1390" length="38912" talkid="70941">
        <protection>
          <pr type="edit" level="autoconfirmed" expiry="2008-07-09T21:08:31Z" />
          <pr type="move" level="autoconfirmed" expiry="2008-07-09T21:08:31Z" />
        </protection>
      </page>
    </pages>
  </query>
</api>

[edit] Posibles errores

Ninguno.

[edit] revisions / rv

MediaWiki version: 1.8

Returns revisions for a given page, or the latest revision for each of several pages. When using parameters marked as (enum), titles= must have only one title listed.

[edit] Parameters

  • rvprop: Which properties to get for each revision
    • ids: Revision ID (default)
    • flags: Whether the revision was a minor edit (default)
    • timestamp: The date and time the revision was made (default)
    • user: The user who made the revision (default)
    • comment: The edit comment (default)
    • size: The size of the revision text in bytes
    • content: The revision content. If set, the maximum limit will be 10 times as low
  • rvlimit: The maximum number of revisions to return (enum)
  • rvstartid: Revision ID to start listing from. (enum)
  • rvendid: Revision ID to stop listing at. (enum)
  • rvstart: Timestamp to start listing from. (enum)
  • rvend: Timestamp to end listing at. (enum)
  • rvdir: Direction to list in. (enum)
    • older: List newest revisions first (default). NOTE: rvstart/rvstartid has to be higher than rvend/rvendid
    • newer: List oldest revisions first. NOTE: rvstart/rvstartid has to be lower than rvend/rvendid
  • rvuser: Only list revisions made by this user
  • rvexcludeuser: Do not list revisions made by this user
  • rvexpandtemplates: Expand templates in rvprop=content output
  • rvsection: If rvprop=content is set, only retrieve the contents of this section. NOTE: Only implemented in MediaWiki versions 1.13 and above.
  • rvtoken: Tokens to get for each revision

[edit] Example

Get data including content for the last revision of titles en:API and en:Main Page

api.php ? action=query & prop=revisions & titles=API|Main%20Page & rvprop=timestamp|user|comment|content

<api>
  <query>
    <pages>
      <page pageid="1191" ns="0" title="API">
        <revisions>
          <rev user="Harryboyles" timestamp="2006-10-31T05:39:01Z" comment="revert unexplained change: see talk ...">
            ...content...
          </rev>
        </revisions>
      </page>
      <page pageid="11105676" ns="0" title="Main Page">
        <revisions>
          <rev user="Ryan Postlethwaite" timestamp="2007-06-26T19:05:06Z" comment="rv - what was that for?">
            ...content...
          </rev>
        </revisions>
      </page>
    </pages>
  </query>
</api>

[edit] Possible errors

  • code: rvrevids
    • info: The revids= parameter may not be used with the list options (limit, startid, endid, dirNewer, start, end).
  • code: rvmultpages
    • info: titles, pageids or a generator was used to supply multiple pages, but the limit, startid, endid, dirNewer, user, excludeuser, start and end parameters may only be used on a single page.
  • code: rvaccessdenied
    • info: The current user is not allowed to read title
  • code: rvbadparams
    • info: start and startid cannot be used together
  • code: rvbadparams
    • info: end and endid cannot be used together
  • code: rvbadparams
    • info: user and excludeuser cannot be used together
  • code: rvnosuchsection
    • info: There is no section section in rrevid

[edit] categories / cl

MediaWiki version: 1.11

Gets a list of all categories used on the provided pages. This module can be used as a generator.

[edit] Parameters

  • clprop: Which properties to get (cannot be used with a generator)
    • sortkey: The sort key

[edit] Example

Get a list of categories en:Albert Einstein belongs to

api.php ? action=query & titles=Albert%20Einstein & prop=categories

<api>
  <query>
    <pages>
      <page pageid="736" ns="0" title="Albert Einstein">
        <categories>
          <cl ns="14" title="Category:1879 births" />
          <cl ns="14" title="Category:1955 deaths" />
          <cl ns="14" title="Category:Albert Einstein" />
          ...
        </categories>
      </page>
    </pages>
  </query>
</api>

[edit] Possible errors

None

[edit] imageinfo / ii

MediaWiki version: 1.11

Gets image information for any titles in the image namespace

[edit] Parameters

  • iiprop: Which properties to get
    • timestamp: The time and date of the revision (default)
    • user: The user who made the revision (default)
    • comment: The edit comment
    • url: URL of the image
    • size: The image's size in bytes
    • sha1: The image's SHA-1 hash
    • mime: The image's MIME type
    • metadata: Image metadata, if available
    • archivename: Archive name (old images only)
  • iilimit: How many image revisions to return (1 by default)
  • iistart: Timestamp to start listing from
  • iiend: Timestamp to stop listing at
  • iiurlwidth: If iiprop=url is set, a URL to an image scaled to this width will be returned as well. Old versions of images can't be scaled
  • iiurlheight: Similar to iiurlwidth

[edit] Example

Get image information for the en:Image:Albert Einstein Head.jpg. Note that the image page might be missing when the image exists on commons.

api.php ? action=query & titles=Image:Albert%20Einstein%20Head.jpg & prop=imageinfo

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query>
    <pages>
      <page ns="6" title="Image:Albert Einstein Head.jpg" missing="" imagerepository="shared">
        <imageinfo>
          <ii timestamp="2007-10-20T02:29:04Z" user="Rocket000" />
        </imageinfo>
      </page>
    </pages>
  </query>
  <query-continue>
    <imageinfo iistart="20071020022358" />
  </query-continue>
</api>

[edit] langlinks / ll

MediaWiki version: 1.9

Gets a list of all language links from the provided pages to other languages.

[edit] Parameters

None

[edit] Example

Get a list of language links en:Albert Einstein has

api.php ? action=query & titles=Albert%20Einstein & prop=langlinks

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query>
    <pages>
      <page pageid="736" ns="0" title="Albert Einstein">
        <langlinks>
          <ll lang="af">Albert Einstein</ll>
          <ll lang="als">Albert Einstein</ll>
          <ll lang="an">Albert Einstein</ll>
          <ll lang="ar">ألبرت أينشتاين</ll>
          <ll lang="ast">Albert Einstein</ll>
          <ll lang="az">Albert Eynşteyn</ll>
          ...
        </langlinks>
      </page>
    </pages>
  </query>
</api>

[edit] Possible errors

None

[edit] links / pl

MediaWiki version: 1.9

Gets a list of all links on the provided pages. This module can be used as a generator.

[edit] Parameters

  • plnamespace: Only list links to pages in these namespaces

[edit] Example

Get a list of links on en:Albert Einstein

api.php ? action=query & titles=Albert%20Einstein & prop=links

<api>
  <query>
    <pages>
      <page pageid="736" ns="0" title="Albert Einstein">
        <links>
          <pl ns="0" title="1879" />
          <pl ns="0" title="1901" />
          ...
          <pl ns="0" title="Albert Einstein: The Practical Bohemian" />
          <pl ns="0" title="Albert Einstein Archives" />
          <pl ns="0" title="Albert Einstein Award" />
          <pl ns="0" title="Albert Einstein Foundation for Higher Learning, Inc." />
          <pl ns="0" title="Albert Einstein Memorial" />
          <pl ns="0" title="Albert Einstein Peace Prize" />
          ...
          <pl ns="0" title="Zurich" />
          <pl ns="4" title="Wikipedia:Citing sources" />
          <pl ns="4" title="Wikipedia:Media help" />
          <pl ns="4" title="Wikipedia:Persondata" />
          <pl ns="4" title="Wikipedia:Protection policy" />
          <pl ns="4" title="Wikipedia:Sister projects" />
          <pl ns="6" title="Image:Albert Einstein german.ogg" />
          <pl ns="10" title="Template:Nobel Prize in Physics" />
          ...
          <pl ns="10" title="Template:Nobel Prize in Physics Laureates 2001-2025" />
          <pl ns="11" title="Template talk:Nobel Prize in Physics Laureates 1901-1925" />
        </links>
      </page>
    </pages>
  </query>
</api>

[edit] Possible errors

None

[edit] templates / tl

MediaWiki version: 1.9

Gets a list of all pages included in the provided pages. This module can be used as a generator.

[edit] Parameters

  • tlnamespace: Only list pages in these namespaces

[edit] Example

Get a list of templates used on en:Albert Einstein's page

api.php ? action=query & titles=Albert%20Einstein & prop=templates

<api>
  <query>
    <pages>
      <page pageid="736" ns="0" title="Albert Einstein">
        <templates>
          <tl ns="10" title="Template:Academia" />
          <tl ns="10" title="Template:Age at date" />
          <tl ns="10" title="Template:Audio" />
          <tl ns="10" title="Template:Birth date" />
          ...
        </templates>
      </page>
    </pages>
  </query>
</api>

[edit] Possible errors

None.

[edit] images / im

MediaWiki version: 1.9

In Query API interface, this command found pages that embedded the given image. It has been renamed to imageusage.

Gets a list of all images used on the provided pages. This module can be used as a generator.

[edit] Parameters

None.

[edit] Example

Get a list of images on en:Albert Einstein's page

api.php ? action=query & titles=Albert%20Einstein & prop=images

<api>
  <query>
    <pages>
      <page pageid="736" ns="0" title="Albert Einstein">
        <images>
          <im ns="6" title="Image:1919 eclipse positive.jpg" />
          <im ns="6" title="Image:Albert Einstein Head.jpg" />
          <im ns="6" title="Image:Albert Einstein german.ogg" />
          <im ns="6" title="Image:Albert Einstein photo 1921.jpg" />
          ...
        </images>
      </page>
    </pages>
  </query>
</api>

[edit] Possible errors

None.

[edit] extlinks / el

MediaWiki version: 1.11

Gets a list of all external links on the provided pages

[edit] Parameters

None.

[edit] Example

Get a list of external links on en:Albert Einstein's page

api.php ? action=query & titles=Albert%20Einstein & prop=extlinks

<api>
  <query>
    <pages>
      <page pageid="736" ns="0" title="Albert Einstein">
        <extlinks>
          <el>http://albert-einstein.org/</el>
          <el>http://albert-einstein.org/history5.html</el>
          <el>http://ame.epfl.ch/biblio/schlatter1.pdf</el>
          ...
        </extlinks>
      </page>
    </pages>
  </query>
</api>

[edit] Possible errors

None.

[edit] categoryinfo / ci

[edit] info / in

MediaWiki version: 1.13

Gets information about categories

[edit] Parameters

None

[edit] Example

Get info about a few categories

api.php ? action=query & titles=Albert%20Einstein & prop=categoryinfo

<?xml version="1.0" encoding="utf-8"?>
<api>
  <query>
    <normalized>
      <n from="Category:Templates_using_ParserFunctions" to="Category:Templates using ParserFunctions" />
    </normalized>
    <pages>
      <page ns="14" title="Category:Foo" missing="" />
      <page ns="14" title="Category:Templates using ParserFunctions" missing="">
        <categoryinfo size="8" pages="8" files="0" subcats="0" />
      </page>
      <page pageid="37" ns="14" title="Category:Infobox">
        <categoryinfo size="0" pages="1" files="-1" subcats="0" />
      </page>
    </pages>
  </query>
</api>

[edit] Possible errors

None

Personal tools