MediaWiki API 帮助
这是自动生成的MediaWiki API文档页面。
文档和例子:https://www.mediawiki.org/wiki/API:Main_page/zh
action=protect
(main | protect)
- 此模块需要读取权限。
 - 此模块需要写入权限。
 - 此模块只允许POST请求。
 - 来源:MediaWiki
 - 许可协议:GPL-2.0-or-later
 
更改页面的保护等级。
参数:
- title
 要(解除)保护的页面标题。不能与pageid一起使用。
- pageid
 要(解除)保护的页面ID。不能与title一起使用。
- Type: integer
 - protections
 保护等级列表,格式:action=level(例如edit=sysop)。等级all意味着任何人都可以执行操作,也就是说没有限制。
注意:未列出的操作将移除限制。
- This parameter is required.
 - 通过|或替代物隔开各值。
 - Maximum number of values is 50 (500 for clients allowed higher limits).
 - expiry
 到期时间戳。如果只有一个时间戳被设置,它将被用于所有保护。使用infinite、indefinite、infinity或never用于永不过期的保护。
- 通过|或替代物隔开各值。
 - Maximum number of values is 50 (500 for clients allowed higher limits).
 - Default: infinite
 - reason
 (解除)保护的原因。
- 默认:(空)
 - tags
 要在保护日志中应用到实体的更改标签。
- 值(以|或替代物分隔):
 - cascade
 启用连锁保护(也就是保护包含于此页面的页面)。如果所有提供的保护等级不支持连锁,就将其忽略。
- Type: boolean (details)
 - watch
 - 已弃用。
 如果设置,就加入已开始(解除)保护的页面至当前用户的监视列表。
- Type: boolean (details)
 - watchlist
 无条件地将页面加入至当前用户的监视列表或将其移除,使用设置或不更改监视。
- 以下值中的一个:nochange、preferences、unwatch、watch
 - Default: preferences
 - token
 从action=query&meta=tokens取回的“csrf”令牌
- This parameter is required.
 
例子:
- 保护一个页面。
 - api.php?action=protect&title=Main%20Page&token=123ABC&protections=edit=sysop|move=sysop&cascade=&expiry=20070901163000|never [在沙盒中打开]
 - 通过设置限制为all解除保护一个页面(就是说任何人都可以执行操作)。
 - api.php?action=protect&title=Main%20Page&token=123ABC&protections=edit=all|move=all&reason=Lifting%20restrictions [在沙盒中打开]
 - 通过设置没有限制解除保护一个页面。
 - api.php?action=protect&title=Main%20Page&token=123ABC&protections=&reason=Lifting%20restrictions [在沙盒中打开]