Updated on 2024-04-12 GMT+08:00

Creating a Cache Prefetch Task

Function

This API is used to create a cache prefetch task.

URI

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

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Enterprise project to which the cache prefetch 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 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

preheating_task

Yes

PreheatingTaskRequestBody object

Cache prefetch settings.

Table 4 PreheatingTaskRequestBody

Parameter

Mandatory

Type

Description

zh_url_encode

No

Boolean

Whether to encode Chinese characters in URLs before cache prefetch. The value false indicates that this function is disabled, and true indicates that this function is enabled. After the function is enabled, only content of transcoded URLs is prefetched.

urls

Yes

Array of strings

A URL must contain http:// or https://. A URL can contain up to 4,096 characters. Enter up to 1,000 URLs and separate them by commas (,). Currently, directory prefetch is not supported.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

preheating_task

String

Task ID.

Example Requests

POST https://cdn.myhuaweicloud.com/v1.0/cdn/content/preheating-tasks?enterprise_project_id=0

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

Example Responses

Status code: 200

OK

{
  "preheating_task" : "7620242"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.