Updated on 2024-06-11 GMT+08:00

Creating a Cache Refreshing Task

Function

This API is used to create a cache refreshing task.

URI

POST /v1.0/cdn/content/refresh-tasks

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Enterprise project to which the cache refreshing task is added. This parameter is valid only when the enterprise project function is enabled. The value all indicates all projects. This parameter is mandatory when you use an IAM user to call this API.

Obtain the enterprise project ID by calling the ListEnterpriseProject API of Enterprise Project Management Service (EPS).

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 corresponding IAM API (value of X-Subject-Token in the response header).

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

refresh_task

Yes

RefreshTaskRequestBody object

Cache refreshing settings.

Table 4 RefreshTaskRequestBody

Parameter

Mandatory

Type

Description

type

No

String

Type of cached content to be refreshed. Possible values: file and directory. Default value: file.

urls

Yes

Array of strings

A URL must contain http:// or https://. A URL can contain up to 4096 characters. Enter up to 1000 URLs or 100 directories and separate them by commas (,).

NOTE:

If a URL contains Chinese characters, refresh both this URL and its encoded URL.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

refresh_task

String

Task ID.

Example Requests

POST https://{endpoint}/v1.0/cdn/content/refresh-tasks?enterprise_project_id=0

{
  "refresh_task" : {
    "type" : "file",
    "urls" : [ "https://www.bxxx/1.txt", "http://www.bxxx/2.txt" ]
  }
}

Example Responses

Status code: 200

OK

{
  "refresh_task" : "7620242"
}

Status Codes

Status Code

Description

200

OK