Help Center> Content Delivery Network> API Reference> API> Cache Refreshing and Preheating> Querying Cache Refreshing and Preheating Tasks
Updated on 2024-06-11 GMT+08:00

Querying Cache Refreshing and Preheating Tasks

Function

This API is used to query cache refreshing and preheating tasks.

URI

GET /v1.0/cdn/historytasks

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

ID of the enterprise project to which the resource belongs. 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).

page_size

No

Integer

Maximum number of records on each page. The value ranges from 1 to 10,000. Both page_size and page_number must be set. Default value: 30.

page_number

No

Integer

Number of the page to be queried. The value ranges from 1 to 65,535. Default value: 1.

status

No

String

Task status. task_inprocess: The task is being processed. task_done: The task is completed.

start_date

No

Long

Query start time. The value is the number of milliseconds since the UNIX epoch (Jan 1, 1970).

end_date

No

Long

Query end time. The value is the number of milliseconds since the UNIX epoch (Jan 1, 1970).

order_field

No

String

Field used for sorting. Supported fields include task_type (task type), total (total number of URLs), processing (number of URLs that are being processed), succeed (number of processed URLs), failed (number of URLs that fail to be processed), and create_time (task creation time). Both order_field and order_type must be set. Otherwise, the default values create_time and desc are used.

order_type

No

String

desc: descending order; asc: ascending order. Default value: decs.

file_type

No

String

Content type. The default value is file. Possible values: file and directory.

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).

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

total

Integer

Total number of tasks.

tasks

Array of TasksObject objects

Log list.

Table 4 TasksObject

Parameter

Type

Description

id

String

Task ID.

task_type

String

Task type. Possible values: refresh and preheating.

status

String

Refreshing task result. task_done: The task is completed. task_inprocess: The task is being processed.

processing

Integer

Number of URLs that are being processed.

succeed

Integer

Number of URLs processed.

failed

Integer

Number of URLs that failed to be processed.

total

Integer

Total number of URLs in the task.

create_time

Long

Time when the task was created. The value is the number of milliseconds since the UNIX epoch (Jan 1, 1970).

file_type

String

Content type. The default value is file. Possible values: file and directory.

Example Requests

GET https://{endpoint}/v1.0/cdn/historytasks?status=task_inprocess&page_size=30&page_number=1&enterprise_project_id=0

Example Responses

Status code: 200

OK

{
  "total" : 2,
  "tasks" : [ {
    "id" : "ff8080xxxxxxxxxxxxd816ff0128",
    "status" : "task_inprocess",
    "processing" : 2,
    "succeed" : 0,
    "failed" : 0,
    "task_type" : "refresh",
    "total" : 2,
    "create_time" : 1534240233215,
    "file_type" : "file"
  }, {
    "id" : "ff8080xxxxxxxxxxx4fe64797",
    "status" : "task_inprocess",
    "processing" : 1,
    "succeed" : 0,
    "failed" : 0,
    "task_type" : "refresh",
    "total" : 1,
    "create_time" : 1534240219944,
    "file_type" : "file"
  } ]
}

Status Codes

Status Code

Description

200

OK