All Products
Search
Document Center

Web Application Firewall:ModifyProtectionRuleStatus

Last Updated:Feb 26, 2025

Enables or disables a rule of a specific protection module for a domain name. The protection modules include the website tamper-proofing, allowed crawlers, bot threat intelligence, custom protection policy, and website whitelist.

You can set the DefenseType parameter to specify the protection module. For more information about the value, see the description of the DefenseType parameter in the "Request parameters" section of this topic.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

ModifyProtectionRuleStatus

The operation that you want to perform. Set the value to ModifyProtectionRuleStatus.

DefenseType

String

Yes

tamperproof

The protection module. Valid values:

  • tamperproof: Website Tamper-proofing

  • bot_crawler: Allowed Crawlers

  • bot_intelligence: Bot Threat Intelligence

  • ac_custom: Custom Protection Policy

  • whitelist: Website Whitelist

Domain

String

Yes

www.example.com

The domain name that is added to WAF.

InstanceId

String

Yes

waf_elasticity-cn-0xldbqt****

The ID of the WAF instance.

Note

You can call the DescribeInstanceInfo operation to query the ID of the WAF instance.

LockVersion

Long

Yes

2

The version of the rule.

RuleId

Long

Yes

42755

The ID of the rule.

Note

You can call the DescribeProtectionModuleRules operation to query the IDs of all rules.

RuleStatus

Integer

Yes

1

The status of the rule. Valid values:

  • 0: disabled

  • 1: enabled

RegionId

String

No

ap-southeast-1

The region ID of the WAF instance. Valid values:

  • cn-hangzhou: The Chinese mainland.

  • ap-southeast-1: Outside the Chinese mainland.

ResourceGroupId

String

No

rg-atstuj3rtop****

The resource group ID to which the WAF instance belongs in the Resource Management. Defaults to empty, indicating it is part of the default resource group.

Response parameters

Parameter

Type

Example

Description

RequestId

String

D7861F61-5B61-46CE-A47C-6B19160D5EB0

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ModifyProtectionRuleStatus
&DefenseType=tamperproof
&Domain=www.example.com
&InstanceId=waf_elasticity-cn-0xldbqt****
&LockVersion=2
&RuleId=42755
&RuleStatus=1
&RegionId=ap-southeast-1
&ResourceGroupId=rg-atstuj3rtop****
&<Common request parameters>

Sample success responses

XML format

<ModifyProtectionRuleStatusResponse>
      <RequestId>D7861F61-5B61-46CE-A47C-6B19160D5EB0</RequestId>
</ModifyProtectionRuleStatusResponse>

JSON format

{
    "RequestId": "D7861F61-5B61-46CE-A47C-6B19160D5EB0"
}

Error codes

For a list of error codes, visit the API Error Center.