Jump to content
MediaWiki

API:ChangeContentModel

From mediawiki.org
This page is a translated version of the page API:ChangeContentModel and the translation is 100% complete.
Esta página é parte da documentação da API action do MediaWiki.
API de ação do MediaWiki
Básico
Autenticação
Contas e usuários
Operações de página
Pesquisar
Utilitários do desenvolvedor
Tutoriais
v · d · e
Versão do MediaWiki:
≥ 1.35

POST request para alterar o modelo de conteúdo de uma página.

Documentação da API

The following documentation is the output of Special:ApiHelp/changecontentmodel, automatically generated by the pre-release version of MediaWiki that is running on this site (MediaWiki.org).

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): AWB, convenient-discussions
model

Content model of the new content.

This parameter is required.
One of the following values: GadgetDefinition, JsonSchema, MassMessageListContent, NewsletterContent, Scribunto, SecurePoll, css, javascript, json, sanitized-css, text, translate-messagebundle, vue, wikitext, worklist
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]

Exemplo

Fazer qualquer POST request é um processo de várias etapas:

  1. Entre através de um dos métodos descritos em API:Iniciar Sessão (autenticação/login) .
  2. Obtenha o token CSRF .
  3. Envie uma POST request, com o token CSRF, para executar uma ação em uma página.

O código de exemplo abaixo cobre a etapa final em detalhes.

POST request

Resposta

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

Possíveis erros

Código Informação
notoken O parâmetro token precisa ser definido.
missingtitle A página que você especificou não existe. Para criar uma nova página com um modelo de conteúdo personalizado, use o módulo action=edit.
nodirectediting O modelo de conteúdo 1ドル não suporta a edição direta
nochanges Nenhuma alteração foi solicitada.
cannotbeused O modelo de conteúdo 1ドル não pode ser usado em 2ドル
cannot-convert Não foi possível converter 1ドル em modelo de conteúdo 2ドル

Ver também

AltStyle によって変換されたページ (->オリジナル) /