Creating a Cache Purge Task
Function
This API is used to create a cache purge task.
URI
POST /v1.0/cdn/content/refresh-tasks
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
enterprise_project_id |
No |
String |
Enterprise project to which the cache purge 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
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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
refresh_task |
Yes |
RefreshTaskRequestBody object |
Cache purge settings. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
No |
String |
Type of cached content to be purged. Possible values: file and directory. Default value: file. |
mode |
No |
String |
Directory purge mode. Possible values: all (refresh all resources in the directory) and detect_modify_refresh (refresh changed resources in the directory). The default value is all. |
zh_url_encode |
No |
Boolean |
Whether to encode Chinese characters in URLs before cache purge. The value false indicates that this function is disabled, and true indicates that this function is enabled. After the function is enabled, cache is purged only for transcoded URLs. |
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 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
Parameter |
Type |
Description |
---|---|---|
refresh_task |
String |
Task ID. |
Example Requests
POST https://cdn.myhuaweicloud.com/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 |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot