API:ChangeContentModel/th
Appearance
This page is part of the MediaWiki Action API documentation. |
เวอร์ชันมีเดียวิกิ: | ≥ 1.35 |
POST request to change the content model of a page.
API documentation
Example
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
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 [ลองใช้ในกระบะทรายเอพีไอ]
Response
{
"changecontentmodel": {
"title": "Main Page",
"pageid": 123,
"contentmodel": "text",
"logid": 100,
"revid": 200
}
}
Possible errors
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 |