Skip to content
Start here

Create multiple prefixes.

client.DDoSProtection.AdvancedTCPProtection.Prefixes.BulkNew(ctx, params) (*SinglePage[AdvancedTCPProtectionPrefixBulkNewResponse], error)
POST/accounts/{account_id}/magic/advanced_tcp_protection/configs/prefixes/bulk

Create multiple prefixes for an account.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
DDoS Protection Write
ParametersExpand Collapse
params AdvancedTCPProtectionPrefixBulkNewParams
AccountID param.Field[string]

Path param: Identifier.

maxLength32
Body param.Field[[]AdvancedTCPProtectionPrefixBulkNewParamsBody]

Body param

Comment string

A comment describing the prefix.

Excluded bool

Whether to exclude the prefix from protection.

Prefix string

The prefix to add in CIDR format.

ReturnsExpand Collapse
type AdvancedTCPProtectionPrefixBulkNewResponse struct{…}
ID string

The unique ID of the prefix.

Comment string

A comment describing the prefix.

CreatedOn Time

The creation timestamp of the prefix.

formatdate-time
Excluded bool

Whether to exclude the prefix from protection.

ModifiedOn Time

The last modification timestamp of the prefix.

formatdate-time
Prefix string

The prefix in CIDR format.

Create multiple prefixes.

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/ddos_protection"
  "github.com/stainless-sdks/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.DDoSProtection.AdvancedTCPProtection.Prefixes.BulkNew(context.TODO(), ddos_protection.AdvancedTCPProtectionPrefixBulkNewParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    Body: []ddos_protection.AdvancedTCPProtectionPrefixBulkNewParamsBody{ddos_protection.AdvancedTCPProtectionPrefixBulkNewParamsBody{
      Comment: cloudflare.F("comment"),
      Excluded: cloudflare.F(true),
      Prefix: cloudflare.F("192.0.2.0/24"),
    }},
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "id",
      "comment": "comment",
      "created_on": "2019-12-27T18:11:19.117Z",
      "excluded": true,
      "modified_on": "2019-12-27T18:11:19.117Z",
      "prefix": "192.0.2.0/24"
    }
  ],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "id",
      "comment": "comment",
      "created_on": "2019-12-27T18:11:19.117Z",
      "excluded": true,
      "modified_on": "2019-12-27T18:11:19.117Z",
      "prefix": "192.0.2.0/24"
    }
  ],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}