文档首页/ 内容分发网络 CDN/ API参考/ API/ 模板配置/ 查询域名模板应用记录 - ShowAppliedTemplateRecord
更新时间:2026-07-20 GMT+08:00
分享

查询域名模板应用记录 - ShowAppliedTemplateRecord

功能介绍

查询域名模板应用记录。

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项
  • 如果使用身份策略授权,需具备如下身份策略权限。

    授权项

    访问级别

    资源类型(*为必须)

    条件键

    别名

    依赖的授权项

    cdn:configuration:queryDomains

    Read

    domain *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    -

    -

URI

GET /v1.0/cdn/configuration/tml-apply-records

表1 Query参数

参数

是否必选

参数类型

描述

tml_id

String

参数解释:

域名模板ID,可以通过查询域名模板列表接口获取

约束限制:

不涉及

取值范围:

不涉及

默认取值:

不涉及

tml_name

String

参数解释:

域名模板名称

约束限制:

不涉及

取值范围:

  • 1-100个字符

  • 仅支持字母、数字、中文、下划线(_)、中横线(-)

默认取值:

不涉及

operator_id

String

参数解释:

域名模板操作ID,可以通过本接口获取

约束限制:

不涉及

取值范围:

不涉及

默认取值:

不涉及

offset

Integer

参数解释:

查询的页码

约束限制:

不涉及

取值范围:

0-65535

默认取值:

0

limit

Integer

参数解释:

每页应用记录的数量

约束限制:

不涉及

取值范围:

1-10000

默认取值:

30

请求参数

响应参数

状态码:200

表2 响应Body参数

参数

参数类型

描述

total

Integer

参数解释:

查询域名模板总数

取值范围:

不涉及

elements

Array of ApplyRecord objects

参数解释:

域名模板应用记录

表3 ApplyRecord

参数

参数类型

描述

status

String

参数解释:

应用模板结果

取值范围:

  • success: 应用模板成功

  • fail: 应用模板失败

operator_id

String

参数解释:

操作ID

取值范围:

不涉及

tml_name

String

参数解释:

域名模板名称

取值范围:

  • 1-100个字符

  • 仅支持字母、数字、中文、下划线(_)、中横线(-)

remark

String

参数解释:

域名模板描述

取值范围:

不涉及

tml_id

String

参数解释:

域名模板ID

取值范围:

不涉及

apply_time

Integer

参数解释:

域名模板应用时间

取值范围:

不涉及

type

Integer

参数解释:

域名模板类型

取值范围:

  • 1: 系统预置模板

  • 2: 租户自定义模板

account_id

String

参数解释:

账户ID

取值范围:

不涉及

resources

Array of Resource objects

参数解释:

应用模板配置信息

configs

TemplateConfigs object

参数解释:

域名模板配置

表4 Resource

参数

参数类型

描述

status

String

参数解释:

应用模板状态(域名粒度)

取值范围:

  • success: 应用模板成功

  • fail: 应用模板失败

domain_name

String

参数解释:

域名

取值范围:

不涉及

error_msg

String

参数解释:

错误信息

取值范围:

不涉及

表5 TemplateConfigs

参数

参数类型

描述

http_response_header

Array of HttpResponseHeader objects

参数解释:

HTTP响应头,CDN节点响应客户端时,根据HTTP响应头配置操作响应的HTTP头部信息

cache_rules

Array of CacheRules objects

参数解释:

设置源站资源在CDN节点的缓存时长

origin_follow302_status

String

参数解释:

开启回源跟随,当源站地址因业务需求做了301/302 重定向,CDN节点会先跳转到301/302对应地址获取资源,缓存后再返回给用户

取值范围:

  • on: 开启

  • off: 关闭

compress

Compress object

参数解释:

智能压缩,压缩网站的静态资源,缩小传输文件的大小,提升传输效率,减少带宽消耗

origin_range_status

String

参数解释:

Range回源,开启后,源站在收到CDN节点回源请求时,根据HTTP请求头中的Range信息返回指定范围的数据给CDN节点

取值范围:

  • on: 开启

  • off: 关闭

ip_filter

IpFilter object

参数解释:

IP黑白名单,对用户的请求IP地址进行过滤,从而限制访问来源

referer

RefererConfig object

参数解释:

referer黑白名单,对访问者身份进行识别和过滤,从而限制访问来源

user_agent_filter

UserAgentFilter object

参数解释:

UA黑白名单,对用户请求使用的代理过滤,从而限制访问来源

flow_limit_strategy

Array of FlowLimitStrategy objects

参数解释:

设置用量封顶阈值,当实际用量大于阈值时停用域名,有效预防流量盗刷或恶意攻击带来的高额账单。

说明:
由于监控数据存在时延,域名将在用量达到阈值后的10分钟左右被停用
表6 HttpResponseHeader

参数

参数类型

描述

name

String

参数解释:

设置HTTP响应头参数

取值范围:

  • 1-100个字符

  • 由数字,大小写字母,中划线组成,只能以字母开头

value

String

参数解释:

设置HTTP响应头参数的值

取值范围:

  • 1-1000个字符

  • 支持字母、数字和特定字符.-_*#!&+|^~'"/:;,=@?<>等

  • 当为删除动作时,可不填

action

String

参数解释:

设置HTTP响应头操作类型

取值范围:

  • set: 设置

  • delete: 删除

表7 CacheRules

参数

参数类型

描述

match_type

String

参数解释:

匹配类型

取值范围:

  • all: 匹配所有文件

  • file_extension: 按文件后缀匹配

  • catalog: 按目录匹配

  • full_path: 全路径匹配

  • home_page: 按首页匹配

match_value

String

参数解释:

缓存规则匹配内容

取值范围:

不涉及

ttl

Integer

参数解释:

资源在CDN节点的缓存过期时间

取值范围:

不涉及

ttl_unit

String

参数解释:

缓存过期时间单位

取值范围:

  • s: 秒

  • m: 分

  • h: 小时

  • d: 天

priority

Integer

参数解释:

缓存规则的优先级,数值越大,优先级越高

取值范围:

1-100

follow_origin

String

参数解释:

缓存过期时间来源,设置CDN节点的缓存遵循源站还是CDN侧的配置

取值范围:

  • on: CDN节点的缓存过期时间遵循源站的设置

  • off: CDN节点的缓存过期时间遵循“缓存规则”中的“缓存过期时间”

  • min_ttl: CDN节点的缓存过期时间取缓存规则和源站二者的最小值

force_cache

String

参数解释:

强制缓存:CDN节点缓存过期时间是否忽略源站响应头Cache-Control中的no-cache、private、no-store字段

取值范围:

  • on: 打开强制缓存

  • off: 关闭强制缓存

url_parameter_type

String

参数解释:

URL参数

取值范围:

  • del_params: 忽略指定URL参数

  • reserve_params: 保留指定URL参数

  • ignore_url_params: 忽略全部URL参数

  • full_url: 使用完整URL参数

url_parameter_value

String

参数解释:

URL参数值

取值范围:

不涉及

表8 Compress

参数

参数类型

描述

status

String

参数解释:

智能压缩开关

取值范围:

  • on: 开启

  • off: 关闭

type

String

参数解释:

智能压缩类型

取值范围:

多种智能压缩类型用“,”分隔,可选值如下:

  • gzip: gzip压缩

  • br: brotli压缩

file_type

String

参数解释:

需要压缩的文件类型

取值范围:

  • 内容总长度不可超过2000个字符

  • 单个格式不可超过50个字符

  • 多种格式用“,”分隔

compress_min_length

Integer

参数解释:

压缩区间最小范围

取值范围:

  • 文件大小范围(0MB~30MB),单位为Byte

compress_max_length

Integer

参数解释:

压缩区间最大范围

取值范围:

  • 文件大小范围(0MB~30MB),单位为Byte

表9 IpFilter

参数

参数类型

描述

type

String

参数解释:

IP黑白名单类型

取值范围:

  • off: 关闭IP黑白名单

  • black: IP黑名单

  • white: IP白名单

value

String

参数解释:

配置IP黑白名单

说明:
支持IPv6,支持配置IP地址和IP&掩码格式的网段

取值范围:

不涉及

表10 RefererConfig

参数

参数类型

描述

type

String

参数解释:

Referer黑白名单类型

取值范围:

  • off: 关闭Referer黑白名单

  • black: Referer黑名单

  • white: Referer白名单

value

String

参数解释:

域名或IP地址

说明:
域名、IP地址可以混合输入,支持泛域名和带端口的域名

取值范围:

不涉及

include_empty

Boolean

参数解释:

是否包含空Referer

说明:
如果是黑名单并开启该选项,则表示无referer不允许访问

如果是白名单并开启该选项,则表示无referer允许访问

取值范围:

  • true: 包含空

  • false: 不包含空

表11 UserAgentFilter

参数

参数类型

描述

type

String

参数解释:

UA黑白名单类型

取值范围:

  • off: 关闭UA黑白名单

  • black: UA黑名单

  • white: UA白名单

value

String

参数解释:

UA黑白名单内容

说明:
此参数作为旧参数,将于近期下线,建议使用ua_list字段设置UA黑白名单内容

取值范围:

  • 单条规则不超过200个字符

  • 支持数字0-9、字符a-z、A-Z,空格,及特殊符"*"、"."、"-"、"_"、"("、")"、";"、","、"/"、"'"、"#"、"!"、"@"、"$"、"^"、"&"、"+"、"="、"~"、"?"、"""、"["、"]"、"{"、"}"、""、":"、"%"

include_empty

Boolean

参数解释:

是否包含空UA

说明:
如果黑名单并开启该选项,则表示无UA不允许访问

如果是白名单并开启该选项,则表示无UA允许访问

取值范围:

true: 包含空

false:不包含空

ua_list

Array of strings

参数解释:

配置UA黑白名单

表12 FlowLimitStrategy

参数

参数类型

描述

strategy_type

String

参数解释:

用量统计类型

取值范围:

  • instant: 瞬时用量

  • hour: 累计用量(小时)

  • day: 累计用量(天)

item_type

String

参数解释:

用量封顶类型

取值范围:

  • bandwidth: 带宽封顶,单位: bit/s

  • traffic: 流量封顶,单位: bit

limit_value

String

参数解释:

用量封顶阈值,域名用量达到该阈值后,将会停用域名

取值范围:

必须为正整数

alarm_percent_threshold

String

参数解释:

用量告警阈值,域名用量达到该阈值后,将会发送告警

取值范围:

1-90

ban_time

String

参数解释:

域名封禁周期

取值范围:

  • 0: 不自动解封

  • 60: 60分钟,即1个小时

  • 720: 720分钟,即12个小时

  • 1440: 1440分钟,即24个小时

  • 4320: 4320分钟,即3天

状态码:default

表13 响应Body参数

参数

参数类型

描述

error

ErrMsg object

用于返回具体的错误码和错误消息

表14 ErrMsg

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

请求示例

GET https://cdn.myhuaweicloud.com/v1.0/cdn/configuration/tml-apply-records?limit=1000&offset=0

响应示例

状态码:200

成功响应

{
  "total" : 1,
  "elements" : [ {
    "resources" : [ {
      "status" : "success",
      "domain_name" : "www.example.com",
      "error_msg" : ""
    } ],
    "type" : 2,
    "configs" : {
      "http_response_header" : [ {
        "action" : "set",
        "name" : "Content-Disposition",
        "value" : "example"
      } ]
    },
    "status" : "success",
    "tml_name" : "example",
    "tml_id" : "example********************tmlid",
    "operator_id" : "example********************tmlid",
    "account_id" : "example****************accountid",
    "apply_time" : 1700000000000
  } ]
}

SDK代码示例

SDK代码示例如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.GlobalCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.cdn.v2.region.CdnRegion;
import com.huaweicloud.sdk.cdn.v2.*;
import com.huaweicloud.sdk.cdn.v2.model.*;


public class ShowAppliedTemplateRecordSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new GlobalCredentials()
                .withAk(ak)
                .withSk(sk);

        CdnClient client = CdnClient.newBuilder()
                .withCredential(auth)
                .withRegion(CdnRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowAppliedTemplateRecordRequest request = new ShowAppliedTemplateRecordRequest();
        try {
            ShowAppliedTemplateRecordResponse response = client.showAppliedTemplateRecord(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import GlobalCredentials
from huaweicloudsdkcdn.v2.region.cdn_region import CdnRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcdn.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = GlobalCredentials(ak, sk)

    client = CdnClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CdnRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowAppliedTemplateRecordRequest()
        response = client.show_applied_template_record(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
    cdn "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth, err := global.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := cdn.CdnClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := cdn.NewCdnClient(hcClient)

    request := &model.ShowAppliedTemplateRecordRequest{}
	response, err := client.ShowAppliedTemplateRecord(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

成功响应

default

异常响应

错误码

请参见错误码

相关文档