tencent cloud

APIs

ImportZoneConfig

Download
Modo Foco
Tamanho da Fonte
Última atualização: 2026-08-19 16:07:21

1. API Description

Domain name for API request: teo.intl.tencentcloudapi.com.

This API is used to quickly import site configuration files. After the import is initiated, the API will return the corresponding task ID. Users need to use the site configuration import result query API to obtain the execution result of this import task.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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: ImportZoneConfig.
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

Site ID.

Content Yes String

Configuration content to be imported. Use JSON format and encode by UTF-8. You can obtain the configuration content through the site configuration export interface (ExportZoneConfig). You can individually import "Site Acceleration - Global Acceleration Configuration" or "Site Acceleration - Rule Engine". Just pass in the corresponding fields. For specific details, see the example below.
Note: AccelerationDomain (acceleration domain name configuration) and Origin (origin configuration) exported by ExportZoneConfig are temporary not supported for import through this interface. If the Content contains the above configuration content, it will cause import failure.

3. Output Parameters

Parameter Name Type Description
TaskId String

Task Id of this import configuration. Use the site configuration import result query API (DescribeZoneConfigImportResult) to get the execution result of this import job. Note: The import task Id only supports querying the most recent 7 days of import tasks.

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.

4. Example

Example1 Importing Site Layer-7 Acceleration Configuration

This example shows you how to import the whole Layer-7 acceleration configuration under the site zone-m2kplohsdc4b.

Input Example

POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ImportZoneConfig 
<Common request parameters>

{
    "ZoneId": "zone-m2kplohsdc4b",
    "Content": "{\"FormatVersion\":\"1.0\",\"ZoneConfig\": {\"SmartRouting\": {\"Switch\": \"off\"}, \"Cache\": {\"CustomTime\": {\"Switch\": \"on\", \"CacheTime\": 604800}}, \"MaxAge\": {\"FollowOrigin\": \"on\", \"CacheTime\": 600}, \"CacheKey\": {\"FullURLCache\": \"off\", \"QueryString\": {\"Switch\": \"on\", \"Action\": \"includeCustom\", \"Values\": [\"key1\", \"key2\"]}, \"IgnoreCase\": \"on\"}, \"CachePrefresh\": {\"Switch\": \"off\", \"CacheTimePercent\": 90}, \"OfflineCache\": {\"Switch\": \"on\"}, \"Compression\": {\"Switch\": \"on\", \"Algorithms\": [\"brotli\", \"gzip\"]}, \"ImageOptimize\": {\"Switch\": \"off\"}, \"ForceRedirectHTTPS\": {\"Switch\": \"on\", \"RedirectStatusCode\": 302}, \"HSTS\": {\"Switch\": \"on\", \"IncludeSubDomains\": \"on\", \"Timeout\": 16070400, \"Preload\": \"on\"}, \"TLSConfig\": {\"CipherSuite\": \"loose-v2023\", \"Version\": [\"TLSv1\", \"TLSv1.1\", \"TLSv1.2\", \"TLSv1.3\"]}, \"OCSPStapling\": {\"Switch\": \"off\"}, \"HTTP2\": {\"Switch\": \"on\"}, \"QUIC\": {\"Switch\": \"off\"}, \"UpstreamHTTP2\": {\"Switch\": \"off\"}, \"IPv6\": {\"Switch\": \"off\"}, \"WebSocket\": {\"Switch\": \"on\", \"Timeout\": 30}, \"PostMaxSize\": {\"Switch\": \"on\", \"MaxSize\": 838860800}, \"ClientIPHeader\": {\"Switch\": \"off\", \"HeaderName\": \"\"}, \"ClientIPCountry\": {\"Switch\": \"on\", \"HeaderName\": \"EO-Client-IPCountry\"}, \"gRPC\": {\"Switch\": \"off\"}, \"AccelerateMainland\": {\"Switch\": \"off\"}, \"StandardDebug\": {\"Switch\": \"on\", \"AllowClientIPList\": [\"1.2.3.4\"], \"Expires\": \"2023-11-04T04:46:28Z\"}}, \"Rules\": [{\"RuleName\": \"Unnamed Rule\", \"Branches\": [{\"Condition\": \"${http.request.host} matches \".*\"\", \"Actions\": [{\"Name\": \"UpstreamURLRewrite\", \"Parameters\": {\"Type\": \"Path\", \"Action\": \"rmvPrefix\", \"Value\": \"/prefix\"}}], \"SubRules\": [{\"Branches\": [{\"Condition\": \"${http.request.file_extension} in [\".jpg\"]\", \"Actions\": [{\"Name\": \"PostMaxSize\", \"Parameters\": {\"Switch\": \"on\", \"MaxSize\": 524288000}}]}]}, {\"Branches\": [{\"Condition\": \"${http.request.file_extension} in [\".png\"]\", \"Actions\": [{\"Name\": \"PostMaxSize\", \"Parameters\": {\"Switch\": \"on\", \"MaxSize\": 209715200}}]}]}]}]}]}"
}

Output Example

{
    "Response": {
        "TaskId": "33mz68e4gwka",
        "RequestId": "5e0a2b4e-dw6d-4dsa-ac39-1706cbf8a703"
    }
}

Example2 Importing Site Acceleration Configuration for Site Layer-7 Acceleration Configuration

This example shows you how to individually import the global acceleration configuration for the Layer-7 acceleration configuration under the site zone-m2kplohsdc4b.

Input Example

POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ImportZoneConfig 
<Common request parameters>

{
    "ZoneId": "zone-m2kplohsdc4b",
    "Content": "{\"FormatVersion\":\"1.0\",\"ZoneConfig\": {\"SmartRouting\": {\"Switch\": \"off\"}, \"Cache\": {\"CustomTime\": {\"Switch\": \"on\", \"CacheTime\": 604800}}, \"MaxAge\": {\"FollowOrigin\": \"on\", \"CacheTime\": 600}, \"CacheKey\": {\"FullURLCache\": \"off\", \"QueryString\": {\"Switch\": \"on\", \"Action\": \"includeCustom\", \"Values\": [\"key1\", \"key2\"]}, \"IgnoreCase\": \"on\"}, \"CachePrefresh\": {\"Switch\": \"off\", \"CacheTimePercent\": 90}, \"OfflineCache\": {\"Switch\": \"on\"}, \"Compression\": {\"Switch\": \"on\", \"Algorithms\": [\"brotli\", \"gzip\"]}, \"ImageOptimize\": {\"Switch\": \"off\"}, \"ForceRedirectHTTPS\": {\"Switch\": \"on\", \"RedirectStatusCode\": 302}, \"HSTS\": {\"Switch\": \"on\", \"IncludeSubDomains\": \"on\", \"Timeout\": 16070400, \"Preload\": \"on\"}, \"TLSConfig\": {\"CipherSuite\": \"loose-v2023\", \"Version\": [\"TLSv1\", \"TLSv1.1\", \"TLSv1.2\", \"TLSv1.3\"]}, \"OCSPStapling\": {\"Switch\": \"off\"}, \"HTTP2\": {\"Switch\": \"on\"}, \"QUIC\": {\"Switch\": \"off\"}, \"UpstreamHTTP2\": {\"Switch\": \"off\"}, \"IPv6\": {\"Switch\": \"off\"}, \"WebSocket\": {\"Switch\": \"on\", \"Timeout\": 30}, \"PostMaxSize\": {\"Switch\": \"on\", \"MaxSize\": 838860800}, \"ClientIPHeader\": {\"Switch\": \"off\", \"HeaderName\": \"\"}, \"ClientIPCountry\": {\"Switch\": \"on\", \"HeaderName\": \"EO-Client-IPCountry\"}, \"gRPC\": {\"Switch\": \"off\"}, \"AccelerateMainland\": {\"Switch\": \"off\"}, \"StandardDebug\": {\"Switch\": \"on\", \"AllowClientIPList\": [\"1.2.3.4\"], \"Expires\": \"2023-11-04T04:46:28Z\"}}"
}

Output Example

{
    "Response": {
        "TaskId": "33mz68e4gwka",
        "RequestId": "5e0a2b4e-dw6d-4dsa-ac39-1706cbf8a703"
    }
}

Example3 Importing Rule Engine Configuration for Site Layer-7 Acceleration Configuration

This example shows you how to individually import the rule engine configuration for the Layer-7 acceleration configuration under the site zone-m2kplohsdc4b.

Input Example

POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ImportZoneConfig 
<Common request parameters>

{
    "ZoneId": "zone-m2kplohsdc4b",
    "Content": "{\"FormatVersion\":\"1.0\",\"Rules\": [{\"RuleName\": \"Unnamed Rule\", \"Branches\": [{\"Condition\": \"${http.request.host} matches \".*\"\", \"Actions\": [{\"Name\": \"UpstreamURLRewrite\", \"Parameters\": {\"Type\": \"Path\", \"Action\": \"rmvPrefix\", \"Value\": \"/prefix\"}}], \"SubRules\": [{\"Branches\": [{\"Condition\": \"${http.request.file_extension} in [\".jpg\"]\", \"Actions\": [{\"Name\": \"PostMaxSize\", \"Parameters\": {\"Switch\": \"on\", \"MaxSize\": 524288000}}]}]}, {\"Branches\": [{\"Condition\": \"${http.request.file_extension} in [\".png\"]\", \"Actions\": [{\"Name\": \"PostMaxSize\", \"Parameters\": {\"Switch\": \"on\", \"MaxSize\": 209715200}}]}]}]}]}]}"
}

Output Example

{
    "Response": {
        "TaskId": "33mz68e4gwka",
        "RequestId": "5e0a2b4e-dw6d-4dsa-ac39-1706cbf8a703"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

There is no error code related to the API business logic. For other error codes, please see Common Error Codes.

Ajuda e Suporte

Esta página foi útil?

comentários