Bantuan API MediaWiki
Ini merupakan laman dokumentasi MediaWiki API yang dihasilkan secara automatik.
Dokumentasi dan contoh-contoh: https://www.mediawiki.org/wiki/API
action=protect
- Modul ini memerlukan hak membaca.
 - Modul ini memerlukan hak menulis.
 - Modul ini menerima permohonan POST sahaja.
 - Source: MediaWiki
 - License: GPL-2.0-or-later
 
Change the protection level of a page.
- title
 Title of the page to (un)protect. Cannot be used together with pageid.
- pageid
 ID of the page to (un)protect. Cannot be used together with title.
- Type: integer
 - protections
 List of protection levels, formatted action=level (e.g. edit=sysop). A level of all means everyone is allowed to take the action, i.e. no restriction.
Note: Any actions not listed will have restrictions removed.
- Parameter ini diwajibkan.
 - Asingkan nilai-nilai dengan "|".
 - Bilangan nilai maksimum adalah 50 (500 untuk bot).
 - expiry
 Expiry timestamps. If only one timestamp is set, it'll be used for all protections. Use infinite, indefinite, infinity, or never, for a never-expiring protection.
- Asingkan nilai-nilai dengan "|".
 - Bilangan nilai maksimum adalah 50 (500 untuk bot).
 - Asal: infinite
 - reason
 Reason for (un)protecting.
- Asal: (kosong)
 - tags
 Change tags to apply to the entry in the protection log.
- Values (separate with | or alternative):
 - cascade
 Enable cascading protection (i.e. protect transcluded templates and images used in this page). Ignored if none of the given protection levels support cascading.
- Type: boolean (details)
 - watch
 - Lapuk.
 If set, add the page being (un)protected to the current user's watchlist.
- Type: boolean (details)
 - watchlist
 Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.
- One of the following values: nochange, preferences, unwatch, watch
 - Asal: preferences
 - token
 A "csrf" token retrieved from action=query&meta=tokens
- Parameter ini diwajibkan.
 
- Protect a page.
 - api.php?action=protect&title=Main%20Page&token=123ABC&protections=edit=sysop|move=sysop&cascade=&expiry=20070901163000|never [open in sandbox]
 - Unprotect a page by setting restrictions to all (i.e. everyone is allowed to take the action).
 - api.php?action=protect&title=Main%20Page&token=123ABC&protections=edit=all|move=all&reason=Lifting%20restrictions [open in sandbox]
 - Unprotect a page by setting no restrictions.
 - api.php?action=protect&title=Main%20Page&token=123ABC&protections=&reason=Lifting%20restrictions [open in sandbox]