Add WAF Protection Rules - AddWafProtectionRuleInfo
Overview
Add WAF Protection Rules
Definition
Public Parameters
| Parameter Name | Type | Description Information | Required |
|---|---|---|---|
| Action | string | Corresponding API command name, the current API is AddWafProtectionRuleInfo. | Yes |
| PublicKey | string | The user’s public key can be obtained from Console  | Yes |
| Signature | string | User signature generated based on public key and API command, see Signature Algorithm | Yes |
Request Parameters
| Parameter Name | Type | Description Information | Required |
|---|---|---|---|
| ProjectId | string | Project ID. If not filled in, the default project is used, and the sub-account must be filled in. Please refer to the GetProjectList interface. | No |
| RuleNum | int | Number of Rule Matching Conditions | Yes |
| RuleName | string | Rule Name | Yes |
| RuleAction | string | The action after the rule is hit, Deny: Intercept, Accept | Yes |
| RiskRank | string | Risk Level, Low: Low, Middle: Medium, High: High | Yes |
| FullDomain | string | Domain name to add protection rules | Yes |
| Rule.N | string | Rule matching conditions, for example: Field:UserAgent, Operator:Contain, Content:xxxx | Yes |
| RiskType | string | Types of risks; Optional values: scan, loopholes, xss, cc, sql, exec, webshell, infoleak, eaa, protocol, other | No |
Response Field
| Field Name | Type | Description Information | Required |
|---|---|---|---|
| RetCode | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. | Yes |
| Action | string | Operation command name. | Yes |
| Message | string | Returns an error message, providing detailed description when RetCode is non-zero. | No |
| Id | int | The ID of the protection rule returned after successful addition | No |
Example
Request Example
https://api.surfercloud.com/?Action=AddWafProtectionRuleInfo
&ProjectId=org-xxx
&FullDomain=www.test.com
&RuleNum=1
&RuleName=test
&RuleAction=Deny
&RiskRank=Low
&RiskType=scan
&Rule.0=Field:SrcIp,Operator:Contain,Content:2.2.2.2Response Example
{
"Action": "AddWafProtectionRuleInfoResponse",
"Id": 9,
"RetCode": 0
}