API:ChangeContentModel
Appearance
This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≥ 1.35 |
POST request to change the content model of a page.
API documentation
[edit]
Example
[edit]Making any POST request is a multi-step process:
- Log in, via one of the methods described on API:Login .
- GET a CSRF token .
- Send a POST request, with the CSRF token, to take action on a page.
The sample code below covers the final step in detail.
POST request
[edit]Page&model=text&token=123ABC&format=json api.php? action=changecontentmodel& title=Main Page& model=text& token=123ABC& format=json Page&model=text&token=123ABC&format=json [try in ApiSandbox]
Response
[edit]{
"changecontentmodel": {
"title": "Main Page",
"pageid": 123,
"contentmodel": "text",
"logid": 100,
"revid": 200
}
}
Possible errors
[edit]Code | Info |
---|---|
notoken | The token parameter must be set. |
missingtitle | The page you specified doesn't exist. To create a new page with a custom content model, use the action=edit module. |
nodirectediting | $1 content model does not support direct editing |
nochanges | No changes were requested. |
cannotbeused | $1 content model cannot be used on $2 |
cannot-convert | Could not convert $1 to $2 content model |