跳转至

查询域名基础信息

1. 接口描述

接口请求路径:GET /prod-api/multiCdn/domain/describeCdnDomain

describeCdnDomain 用于查询指定 CDN 域名的基础信息,包括套餐、地区、CNAME、回源配置、缓存函数、证书、禁用后动作和强制 HTTPS。账号需具备 cdn2:DescribeAllDomains 权限。

Token 获取方式见 密钥鉴权。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。

参数名称 必选 类型 描述
domainGrnId 是 String Query 参数。域名唯一 ID。示例值:grn:test:multi-cdn:001:domain/01234565d940e553de8e

3. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
data Object 域名基础信息
data.domain String 域名。示例值:www.demo.com
data.domainGrnId String 域名唯一 ID。示例值:grn:test:multi-cdn:001:domain/01234565d940e553de8e
data.oid String 所属套餐 ID。示例值:20250812332409
data.region String 地区。示例值:chinese_mainland
data.cname String CNAME 记录。示例值:www.demo.com.tezhengku.com
data.disableAfter String 禁用之后的动作。取值:only_disable(仅禁用)、to_origin(回源)。示例值:only_disable
data.forceHttps Boolean 是否开启 HTTPS 强制跳转。示例值:false
data.origin MultiOrigin 回源配置
data.cacheFunctions Array of CacheFunction 已关联的缓存函数列表
data.sslConfig SslConfig 证书配置,未配置证书时为 null

4. 示例

示例1 查询域名基础信息

输入示例

GET /prod-api/multiCdn/domain/describeCdnDomain?domainGrnId=grn:test:multi-cdn:001:domain/01234565d940e553de8e

代码调用

请将 {登录域名}、token 替换为实际值。

curl -X GET 'https://{登录域名}/prod-api/multiCdn/domain/describeCdnDomain?domainGrnId=grn:test:multi-cdn:001:domain/01234565d940e553de8e' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.xxxxxx'
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class DescribeCdnDomainTest {

    public static void main(String[] args) throws Exception {
        String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";

        URIBuilder uriBuilder = new URIBuilder("https://{登录域名}/prod-api/multiCdn/domain/describeCdnDomain");
        uriBuilder.addParameter("domainGrnId", "grn:test:multi-cdn:001:domain/01234565d940e553de8e");

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            HttpGet httpGet = new HttpGet(uriBuilder.build());
            httpGet.setHeader("Authorization", "Bearer " + token);

            try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
                int statusCode = response.getStatusLine().getStatusCode();
                String body = EntityUtils.toString(response.getEntity(), "UTF-8");
                System.out.println("Status Code: " + statusCode);
                System.out.println("Body: " + body);
            }
        }
    }
}
package main

import (
    "fmt"
    "io"
    "net/http"
    "net/url"
)

func main() {
    token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"

    u, err := url.Parse("https://{登录域名}/prod-api/multiCdn/domain/describeCdnDomain")
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("domainGrnId", "grn:test:multi-cdn:001:domain/01234565d940e553de8e")
    u.RawQuery = q.Encode()

    req, err := http.NewRequest(http.MethodGet, u.String(), nil)
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer "+token)

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println("Status Code:", resp.StatusCode)
    fmt.Println("Body:", string(body))
}

输出示例

{
  "code": 200,
  "msg": "成功",
  "data": {
    "domain": "www.demo.com",
    "domainGrnId": "grn:test:multi-cdn:001:domain/01234565d940e553de8e",
    "origin": {
      "httpOriginPort": 80,
      "httpsOriginPort": 443,
      "originGroupGrnId": "grn:test:multi-cdn:001:origin/174c12cc214bf7d0020fc48461",
      "originProtocol": "http",
      "host": ""
    },
    "cacheFunctions": [
      {
        "functionGrnId": "grn:test:multi-cdn:001:function/0a1b2c3d4e5f6789",
        "functionName": "cache",
        "config": {
          "contentType": "all",
          "cacheTime": 86400
        },
        "name": "全站缓存一天",
        "remark": "静态资源缓存",
        "updateTime": "2025-12-16 10:21:55"
      }
    ],
    "sslConfig": {
      "certGrnId": "grn:test:multi-cdn:001:certificate/1a2b3c4d5e6f7890",
      "expireTime": "2026-12-01 00:00:00"
    },
    "oid": "20250812332409",
    "region": "chinese_mainland",
    "cname": "www.demo.com.tezhengku.com",
    "disableAfter": "only_disable",
    "forceHttps": false
  }
}

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限
无效的domainGrnId domainGrnId 为空或未传
查询域名失败:域名不存在 域名不存在,或不属于当前账号

6. 数据模型

MultiOrigin

域名回源配置。

参数名称 类型 描述
originGroupGrnId String 源站组 ID,须属于当前账号。示例值:grn:test:multi-cdn:001:origin/174c12cc214bf7d0020fc48461
originProtocol String 回源协议。取值:http(HTTP)、https(HTTPS)、follow(协议跟随)。示例值:http
httpOriginPort Integer HTTP 回源端口。示例值:80
httpsOriginPort Integer HTTPS 回源端口。示例值:443
host String 回源 Host。示例值:origin.demo.com

CacheFunction

已关联到域名的缓存函数。

参数名称 类型 描述
functionGrnId String 函数唯一 ID。示例值:grn:test:multi-cdn:001:function/0a1b2c3d4e5f6789
functionName String 函数名称,缓存函数为 cache。示例值:cache
config Object 缓存函数配置,为去掉 @class 后的 JSON
name String 函数显示名称。示例值:全站缓存一天
remark String 函数备注。示例值:静态资源缓存
updateTime String 更新时间,格式 yyyy-MM-dd HH:mm:ss。示例值:2025-12-16 10:21:55

SslConfig

域名证书配置。

参数名称 类型 描述
certGrnId String 证书唯一 ID。示例值:grn:test:multi-cdn:001:certificate/1a2b3c4d5e6f7890
expireTime String 证书过期时间,格式 yyyy-MM-dd HH:mm:ss。示例值:2026-12-01 00:00:00