Help Center/ Anti-DDoS/ API Reference/ Examples/ Example 2: Configuring the Default Protection Policy
Updated on 2024-09-12 GMT+08:00

Example 2: Configuring the Default Protection Policy

Scenario

You can configure the default protection policy for newly purchased IP addresses on the Anti-DDoS console or by call the API.

Process:
  1. Query the default protection settings for the newly purchased IP addresses.
  2. Configure the default protection policy for newly purchased IP addresses.

Involved APIs

The following APIs are required for configuring default protection policy for newly purchased IP addresses.
  • 1 is used to query default protection settings for the newly purchased IP addresses.
  • 2 is used to configure default protection policy for newly purchased IP addresses.

Procedure

  1. Query default protection settings for the newly purchased IP addresses.

    • API information

      URI format: GET /v1/{project_id}/antiddos/default-config

      For details, see section "Querying the Default Protection Policy Configured for the Newly Purchased Public IP Addresses".

    • Example request

      GET: https://{endpoint}/v1/1858a4e1f99d4454bd6a539d5477f5de/antiddos/default/config

      Obtain {endpoint} from .

      Body:

      {
      }
    • Example response
      {
      "app_type_id": 1,
      "cleaning_access_pos_id": 8,
      "enable_L7": false,
      "http_request_pos_id": 8,
      "traffic_pos_id": 8
      }

  2. Configure default protection policy for newly purchased IP addresses.

    • API information

      URI format: POST /v1/{project_id}/antiddos/default-config

      For details, see section "Configuring the Default Protection Policy for Newly Purchased Public IP Addresses".

    • Example request

      POST: https://{endpoint}/v1/1858a4e1f99d4454bd6a539d5477f5de/antiddos/default-config

      Obtain {endpoint} from .

      Body:

      {
      "app_type_id": 1,
      "cleaning_access_pos_id": 8,
      "enable_L7": false,
      "http_request_pos_id": 8,
      "traffic_pos_id": 8
      }
    • Example response
      {
      }