API:İçerikModeliDeğiştir

From mediawiki.org
This page is a translated version of the page API:ChangeContentModel and the translation is 100% complete.
MediaWiki sürümü:
1.35

Bir sayfanın içerik modelini değiştirmek için POST isteği.

API belgesi



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]

Örnek

Herhangi bir POST isteği yapmak çok adımlı bir işlemdir:

  1. API:Oturum aç üzerinde açıklanan yöntemlerden biriyle oturum açın.
  2. bir GET CSRF anahtarı .


  3. Bir sayfada işlem yapmak için CSRF anahtarıyla bir POST isteği gönderin.

Aşağıdaki örnek kod, son adımı ayrıntılı olarak kapsamaktadır.

POST isteği


Yanıt

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

Olası hatalar

Kod Bilgi
notoken token parametresi ayarlanmalıdır.
missingtitle Belirttiğiniz sayfa mevcut değil. Özel içerik modeliyle yeni bir sayfa oluşturmak için action=edit modülünü kullanın.
nodirectediting $1 içerik modeli doğrudan düzenlemeyi desteklemiyor
nochanges Hiçbir değişiklik talep edilmedi.
cannotbeused $1 içerik modeli $2 üzerinde kullanılamaz
cannot-convert $1, $2 içerik modeline dönüştürülemedi

Ayrıca bakınız