API:Tokens (action)/es

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page API:Tokens (action) and the translation is 36% complete.

Other languages:
Deutsch • ‎Deutsch (Sie-Form)‎ • ‎English • ‎dansk • ‎español • ‎português • ‎română • ‎русский • ‎ไทย • ‎中文 • ‎日本語 • ‎한국어
Desde MW 1.24, action=tokens está desaconsejado e incluye una advertencia: "En su lugar usa action=query&meta=tokens".

Tokens can be obtained using action=tokens. These tokens can then be used in other API requests.

Parámetros

  • type: the type of token requested.
    • block
    • delete
    • edit
    • email
    • import
    • move
    • options
    • patrol
    • protect
    • unblock
    • watch

      The Central Auth extension on MediaWiki servers adds the following tokens:
    • deleteglobalaccount
    • setglobalaccountstatus

Ejemplos

Getting an edit token (default behavior)

Getting several tokens at once


Posibles errores

In addition to the usual errors, other errors may be returned in the following format:

<?xml version="1.0"?>
<api>
   <warnings>
      <tokens>Valor no reconocido para el parámetro <var>type</var>: test.</tokens>
   </warnings>
   <tokens/>
</api>

Possible errors include:

  • Valor no reconocido para el parámetro type: value.
  • La acción «xxx» no está permitida para el usuario actual.

Failing to urlencode the token can result in an invalid token error.

Nota importante

You need to send the cookie obtained in the login phase when you call the api with the "tokens" action; otherwise you get the cryptic "readapidenied" error.