Help Center/ Anti-DDoS Service/ API Reference/ Examples/ Example 2: Configuring the Default Protection Policy
Updated on 2024-10-11 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.
  • Step 1 is used to query default protection settings for the newly purchased IP addresses.
  • Step 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 Regions and Endpoints.

      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 Regions and Endpoints.

      Body:

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