API:Protect

POST request to change a page's protection level.

Example
Protecting a page is a multi-step process:   Log in using one of the methods described in .   Get a. This token is the same for all pages, but changes at every login.

  Send a POST request with the CSRF token in order to protect the page.  

The sample code below covers the third step in detail.

Sample code
protect.py

Possible errors
In addition to api>Special:MyLanguage/API:Errors#Standard error messages|the standard error messages:

Parameter history

 * v1.27: Introduced  
 * v1.20: Introduced  
 * v1.17: Introduced  </>. Deprecated <tvar|1> </>
 * v1.15: Introduced <tvar|1> </>

Additional Notes

 * This module requires <tvar|1> </> rights.


 * For MediaWiki versions 1.19 and earlier, you can obtain a protect token through <tvar|1></>.


 * For MediaWiki 1.20-1.23, you can obtain a protect token through <tvar|1></>.