Call the ModifyProtectionRuleStatus API to enable or disable the WAF protection features for the specified domain, including website tamper-proofing, legitimate crawler defense, crawler threat intelligence, custom protection policies, and website whitelist.

You can set the DefenseType parameter to specify the protection module. For more information about the values of this parameter, see the description of DefenseType in the following section.

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 Boolean No ModifyProtectionRuleStatus

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

DefenseType String No tamperproof

The protection module. Valid values:

  • tamperproof: tamper protection
  • bot_crawler: whitelist of legitimate search engines in legitimate crawlers
  • bot_intelligence: Bot Threat Intelligence
  • ac_custom: custom protection policies
  • Whitelist: website whitelist
Domain String No www.example.com

The domain name that has been added to WAF.

InstanceId String No waf_elasticity-cn-0xldbqtm005

The ID of the WAF instance.

Note You can call the DescribeInstanceInfo operation to query the ID of the WAF instance.
LockVersion Long Yes env

The version of the configuration record to be modified.

RuleId Long Yes 42755

The ID of the rule.

Note You can call the DescribeProtectionModuleRules operation to query the ID of a rule.
RuleStatus Integer Yes 1

The status of the rule. Set this parameter to:

  • 0: disables the rule.
  • 1: enables the rule.

Response parameters

Parameter Type Example Description
RequestId String D7861F61-5B61-46CE-A47C-6B19160D5EB0

The ID of the request.

Samples

Sample request

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

Sample success responses

XML format

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

JSON format

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

Error codes.

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