Help Center/ Content Delivery Network/ API Reference/ API/ Cache Purge and Prefetch/ Creating a URL Blocking or Unblocking Task
Updated on 2025-11-27 GMT+08:00

Creating a URL Blocking or Unblocking Task

Function

This API is used to create a URL blocking or unblocking task. To use this API, submit a service ticket.

  • A single tenant can call this API 10 times per second.

Calling Method

For details, see Calling APIs.

URI

POST /v1.0/cdn/content/access-control-urls/{action}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Definition

Operation type.

Constraints

N/A

Range

  • ban: blocking

  • unban: unblocking

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

access_control_urls

Yes

AccessControlUrls object

Information about the URLs to be unblocked or blocked.

Table 4 AccessControlUrls

Parameter

Mandatory

Type

Description

urls

Yes

Array of strings

A URL must contain http:// or https://. Enter up to 1,000 URLs.

ban_duration

No

Integer

Number of days for blocking URLs. The default value is 7 days. The value ranges from 1 to 30.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

task_id

String

Task ID.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error

ErrMsg object

Error code and error message.

Table 7 ErrMsg

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

POST https://cdn.myhuaweicloud.com/v1.0/cdn/content/access-control-urls/ban

{
  "access_control_urls" : {
    "urls" : [ "https://www.example.com/1.txt", "http://www.example.com/2.txt" ],
    "ban_duration" : 1
  }
}

Example Responses

Status code: 200

Successful response.

{
  "task_id" : "71xxxxxxxxxxxxxxxxxxxxxxxxxxxxff"
}

Status Codes

Status Code

Description

200

Successful response.

400

Error response.

Error Codes

See Error Codes.