POST
/
waap
/
v1
/
domains
/
{domain_id}
/
custom-rules
Python
from gcore import Gcore

client = Gcore(
    api_key="My API Key",
)
waap_custom_rule = client.waap.domains.custom_rules.create(
    domain_id=1,
    action={},
    conditions=[{}],
    enabled=True,
    name="Block foobar bot",
)
print(waap_custom_rule.id)
{
  "name": "Block foobar bot",
  "description": "<string>",
  "enabled": true,
  "action": {
    "allow": {},
    "block": {
      "status_code": 403,
      "action_duration": "12h"
    },
    "captcha": {},
    "handshake": {},
    "monitor": {},
    "tag": {
      "tags": [
        "<string>"
      ]
    }
  },
  "conditions": [
    {
      "ip": {
        "negation": false,
        "ip_address": "<string>"
      },
      "ip_range": {
        "negation": false,
        "lower_bound": "<string>",
        "upper_bound": "<string>"
      },
      "url": {
        "negation": false,
        "match_type": "Contains",
        "url": "/wp-admin/"
      },
      "user_agent": {
        "negation": false,
        "user_agent": "curl/",
        "match_type": "Contains"
      },
      "header": {
        "negation": false,
        "header": "Origin",
        "value": "<string>",
        "match_type": "Contains"
      },
      "header_exists": {
        "negation": false,
        "header": "Origin"
      },
      "response_header": {
        "negation": false,
        "header": "<string>",
        "value": "<string>",
        "match_type": "Contains"
      },
      "response_header_exists": {
        "negation": false,
        "header": "<string>"
      },
      "http_method": {
        "negation": false,
        "http_method": "CONNECT"
      },
      "file_extension": {
        "negation": false,
        "file_extension": [
          "pdf"
        ]
      },
      "content_type": {
        "negation": false,
        "content_type": [
          "application/xml"
        ]
      },
      "country": {
        "negation": false,
        "country_code": [
          "<string>"
        ]
      },
      "organization": {
        "negation": false,
        "organization": "UptimeRobot s.r.o"
      },
      "request_rate": {
        "ips": [
          "<string>"
        ],
        "http_methods": [
          "CONNECT"
        ],
        "path_pattern": "/",
        "requests": 21,
        "time": 1800,
        "user_defined_tag": "<string>"
      },
      "owner_types": {
        "negation": false,
        "owner_types": [
          "COMMERCIAL"
        ]
      },
      "tags": {
        "negation": false,
        "tags": [
          "<string>"
        ]
      },
      "session_request_count": {
        "negation": false,
        "request_count": 123
      },
      "user_defined_tags": {
        "negation": false,
        "tags": [
          "<string>"
        ]
      }
    }
  ],
  "id": 123
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

domain_id
integer
required

The domain ID

Required range: x > 0

Body

application/json

A request to create a new WAAP rule

name
string
required

The name assigned to the rule

Required string length: 1 - 100
Examples:

"Block foobar bot"

enabled
boolean
required

Whether or not the rule is enabled

action
object
required

The action that the rule takes when triggered. Only one action can be set per rule.

conditions
CustomRuleCondition · object[]
required

The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger

Required array length: 1 - 5 elements
description
string

The description assigned to the rule

Maximum length: 100

Response

Successful Response

An WAAP rule applied to a domain

name
string
required

The name assigned to the rule

Required string length: 1 - 100
Examples:

"Block foobar bot"

enabled
boolean
required

Whether or not the rule is enabled

action
object
required

The action that the rule takes when triggered. Only one action can be set per rule.

conditions
CustomRuleCondition · object[]
required

The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger

Required array length: 1 - 5 elements
id
integer
required

The unique identifier for the rule

description
string

The description assigned to the rule

Maximum length: 100