API:ChangeContentModel/fr

From mediawiki.org
This page is a translated version of the page API:ChangeContentModel and the translation is 100% complete.
Version de MediaWiki :
1.35

Requête POST pour modifier le modèle de contenu d'une page.

Documentation de l'API



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]

Exemple

Toute requête POST est un processus en plusieurs étapes :

  1. Connectez-vous, via l'une des méthodes décrites sur API:Authentification .
  2. Demandez (GET) un jeton CSRF .


  3. Envoyez une requête POST, avec le jeton CSRF, pour réaliser une action sur une page.

L'exemple de code ci-dessous décrit l'étape finale en détails.

Requête POST


Réponse

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

Erreurs possibles

Code Information
notoken Le paramètre token doit être défini.
missingtitle La page que vous avez spécifiée n’existe pas. Pour créer une nouvelle page avec un modèle de contenu personnalisé, utiliser le module action=edit.
nodirectediting Le modèle de contenu $1 ne prend pas en charge la modification directe
nochanges Aucun changement n’a été demandé.
cannotbeused Le modèle de contenu $1 ne peut être utilisé sur $2
cannot-convert Impossible de convertir $1 en modèle de contenu $2

Voir aussi