API:ChangeContentModel

This page is a translated version of the page API:ChangeContentModel and the translation is 100% complete.
Versión de MediaWiki:
1.35

Petición de CORREO para cambiar el modelo de contenido de una página.

API Documentación



action=changecontentmodel

(main | changecontentmodel)
  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.
  • Source: MediaWiki
  • License: GPL-2.0-or-later

Change the content model of a page

Specific parameters:
Other general parameters are available.
title

Title of the page to change the contentmodel of. Cannot be used together with pageid.

pageid

Page ID of the page to change the contentmodel of. Cannot be used together with title.

Type: integer
summary

Edit summary and log entry reason

tags

Change tags to apply to the log entry and edit.

Values (separate with | or alternative): convenient-discussions, possible vandalism, repeating characters
model

Content model of the new content.

This parameter is required.
One of the following values: GadgetDefinition, Json.JsonConfig, JsonSchema, Map.JsonConfig, MassMessageListContent, NewsletterContent, Scribunto, SecurePoll, Tabular.JsonConfig, css, javascript, json, sanitized-css, text, translate-messagebundle, wikitext
bot

Mark the content model change with a bot flag.

Type: boolean (details)
token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.
Example:
Change the main page to have the text content model
api.php?action=changecontentmodel&title=Main Page&model=text&token=123ABC [open in sandbox]

Ejemplo

Hacer cualquier solicitud POST es un proceso de varios pasos:

  1. Inicia sesión, a través de uno de los métodos descritos en API:Login .
  2. GET un CSRF token .


  3. Envía una solicitud POST, con el token CSRF, para tomar medidas en una página.

El código de muestra, abajo, cubre el paso final en detalle.

Solicitud POST


Respuesta

{
    "changecontentmodel": {
        "title": "Main Page",
        "pageid": 123,
        "contentmodel": "text",
        "logid": 100,
        "revid": 200
    }
}

Posibles errores

Código Información
notoken Se debe establecer el parámetro token.
missingtitle La página que usted ha especificado no existe. Para crear una nueva página con un modelo de contenido a medida, use el modulo action=edit
nodirectediting $1 modelo de contenido no apoya la edición directa.
nochanges No se solicitó ningún cambio.
cannotbeused $1 modelo de contenido no se puede usar en $2
cannot-convert No se pudo convertir el modelo de contenido $1 a $2

Véase también