Domain name for API request: teo.intl.tencentcloudapi.com.
When origin server resources update but the node cache TTL has not expired, users still access old resources. At this point, use this API to update node resources. The following two methods can trigger updates:
For details on purging cache tasks, see Purge Cache.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: CreatePurgeTask. |
| Version | Yes | String | Common Params. The value used for this API: 2022-09-01. |
| Region | No | String | Common Params. This parameter is not required. |
| ZoneId | Yes | String | Zone ID. If you wish to quickly submit Targets Url under different sites, you can fill in *, but the account calling the API must have permission for all site resources under the root account. |
| Type | Yes | String | Node cache clearing type, with values: |
| Method | No | String | Node cache purge method, valid for directory refresh, Hostname refresh, and refresh all cache types. Valid values: |
| Targets.N | No | Array of String | List of resources for cache purging, for example, https://www.example.com/example.jpg. Protocol information must be included. The format of additional elements depends on the type of cache purging. Refer to the API call example below. |
| CacheTag | No | CacheTag | This parameter is required when the node cache purge type is set to purge_cache_tag. The input value is a domain name. |
| Parameter Name | Type | Description |
|---|---|---|
| JobId | String | Task ID. |
| FailedList | Array of FailReason | List of failed tasks and causes. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
This purge type uses the direct deletion purge method, which matches and purges the node cache resources of the submitted URL.
For example, to purge the resource /a.txt under the site domain name www.example.com, refer to the following example to refresh.
POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreatePurgeTask
<Common request parameters>
{
"Targets": [
"http://www.example.com/a.txt"
],
"Type": "purge_url",
"ZoneId": "zone-ajj243dwrew"
}
{
"Response": {
"JobId": "20ga521cpwch",
"FailedList": [],
"RequestId": "3c140219-cfe9-470e-b241-907877d6fb03"
}
}
This purge type uses the expiration marking purge method, which will mark all resources under the submitted Hostname as expired.
For example, to purge all resources belonging to the site domain name www.example.com that have undergone updates, refer to the following example to refresh.
POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreatePurgeTask
<Common request parameters>
{
"Targets": [
"www.example.com"
],
"Type": "purge_host",
"ZoneId": "zone-ajj243dwrew"
}
{
"Response": {
"JobId": "20ga521cpwcs",
"FailedList": [],
"RequestId": "3c140219-cfe9-470e-b241-907877d6fb03"
}
}
This purge type uses the direct purge method, which will purge directly all resources belonging to the site that have the corresponding Cache-Tag response header tag value (tags) in HTTP responses.
For example, to purge all resources belonging to site example.com whose HTTP responses contain tag1, tag2, or tag3, see the following example to refresh.
POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreatePurgeTask
<Common request parameters>
{
"Targets": [
"tag1",
"tag2",
"tag3"
],
"Type": "purge_cache_tag",
"ZoneId": "zone-ajj243dwrew"
}
{
"Response": {
"JobId": "20ga521cpwcs",
"FailedList": [],
"RequestId": "3c140219-cfe9-470e-b241-907877d6fb03"
}
}
This purge type uses the invalidation purging method, which will mark all cached content under the submitted site as expired.
For example, to purge all resources belonging to site example.com that have been updated, see the following example to refresh.
POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreatePurgeTask
<Common request parameters>
{
"Type": "purge_all",
"ZoneId": "zone-ajj243dwrew"
}
{
"Response": {
"JobId": "20ga521cpwcs",
"FailedList": [],
"RequestId": "3c140219-cfe9-470e-b241-907877d6fb03"
}
}
This clearing method requires the Method value to be changed to delete, which directly deletes node resources.
For example, to purge all resources under the /test directory of the site domain name www.example.com, see the following example to refresh.
POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreatePurgeTask
<Common request parameters>
{
"Targets": [
"http://www.example.com/test/"
],
"Type": "purge_prefix",
"Method": "delete",
"ZoneId": "zone-ajj243dwrew"
}
{
"Response": {
"JobId": "20ga521cpwck",
"FailedList": [],
"RequestId": "3c140219-cfe9-470e-b241-907877d6fb03"
}
}
This purge type uses the invalidation purge method by default. You can adjust the purge method based on Method.
For example, to purge all changed resources under the /test directory of the site domain name www.example.com, see the following example to refresh.
POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreatePurgeTask
<Common request parameters>
{
"Targets": [
"http://www.example.com/test/"
],
"Type": "purge_prefix",
"Method": "invalidate",
"ZoneId": "zone-ajj243dwrew"
}
{
"Response": {
"JobId": "20ga521cpwcj",
"FailedList": [],
"RequestId": "3c140219-cfe9-470e-b241-907877d6fb03"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| InternalError.BackendError | Error in background processing. |
| InternalError.DomainConfig | Failed to get configuration. |
| InternalError.ProxyServer | Unknown error occurs on the real server. |
| InternalError.QuotaSystem | Quota system processing failure. |
| InvalidParameter.DomainNotFound | The domain name does not exist or does not belong to this account. |
| InvalidParameter.ParameterError | Parameter error: invalid "end time", not in the allowed query range: [start time, start + 7 days] |
| InvalidParameter.Target | The resource has an error. |
| InvalidParameter.TaskNotGenerated | Task unable to generate. |
| InvalidParameter.UploadUrl | The file upload link has an issue. |
| LimitExceeded.BatchQuota | Resource count in this submission exceeds the upper limit. |
| LimitExceeded.DailyQuota | Resource count submitted on the day exceeds the upper limit. |
| LimitExceeded.PackNotAllow | Billing package unsupported. |
| UnauthorizedOperation.CamUnauthorized | Unauthorized Cam operation. |
| UnauthorizedOperation.NoPermission | The sub-account does not have operation permissions. Add the required permissions and try again. |
| UnauthorizedOperation.Unknown | Unknown error occurs on the real server. |
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários