跳转至

查询域名配置开关

1. 接口描述

接口请求路径:GET /prod-api/cdn/domain/describeConfigSwitch

describeConfigSwitch 用于查询指定域名下各功能开关及超时等配置项的当前状态。data 中开关类字段:0 表示关闭,1 表示开启。需要修改开关时,调用 更新域名配置开关type 一般与下表字段名相同(customHeader 对应 typehttpHeader)。

Token 获取方式见 密钥鉴权

2. 输入参数

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

参数名称 必选 类型 描述
domainId Integer Query 参数。域名 ID
示例值:215

3. 示例

示例1 查询域名配置开关

输入示例

GET /prod-api/cdn/domain/describeConfigSwitch?domainId=215

代码调用

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

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 DescribeConfigSwitchTest {

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

        URIBuilder uriBuilder = new URIBuilder("https://{登录域名}/prod-api/cdn/domain/describeConfigSwitch");
        uriBuilder.addParameter("domainId", "215");

        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/cdn/domain/describeConfigSwitch")
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("domainId", "215")
    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))
}

输出示例

{
  "msg": "成功",
  "code": 200,
  "data": {
    "domainId": 215,
    "customHeader": 1,
    "proxyConnectTimeout": 5,
    "proxyReadTimeout": 60,
    "proxySendTimeout": 60,
    "sendTimeout": 60,
    "httpsStatusCode": 301,
    "httpIPWhitelist": 1,
    "cacheRule": 1,
    "advanced": 0,
    "brotli": 0,
    "limitRate": 0,
    "falsify": 0,
    "infoReveal": 0,
    "waf": null,
    "frequency": 0,
    "customRules": 0,
    "whitelist": 0,
    "ipWhitelist": 0,
    "blacklist": 0,
    "sysRegion": 0,
    "ruleWhite": null,
    "customPage": 0,
    "sslsupport": 1,
    "bot": 0,
    "https_301": 1,
    "webSocket": 1,
    "http2": 1,
    "rangeSource": 0,
    "filterParameters": 0
  }
}

4. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
data Object 配置数据。开关类字段:0 关,1
data.domainId Integer 域名 ID。示例值:215
data.customHeader Integer HTTP Header 开关;更新时 typehttpHeader。示例值:1
data.proxyConnectTimeout Integer 连接上游服务器超时(秒),非开关。示例值:5
data.proxyReadTimeout Integer 回源加载时间(秒),非开关。示例值:60
data.proxySendTimeout Integer 向上游发送请求超时(秒),非开关。示例值:60
data.sendTimeout Integer 向客户端发送响应超时(秒),非开关。示例值:60
data.httpsStatusCode Integer 跳转方式。301 / 302,非开关。示例值:301
data.httpIPWhitelist Integer IP 白名单开关,type 同字段名。示例值:1
data.cacheRule Integer 缓存配置开关,type 同字段名。示例值:1
data.advanced Integer 指定路径高级开关,type 同字段名。示例值:0
data.brotli Integer Brotli 压缩开关,type 同字段名。示例值:0
data.limitRate Integer 下行限速开关,type 同字段名。示例值:0
data.falsify Integer 防篡改开关,type 同字段名。示例值:0
data.infoReveal Integer 防信息泄露开关,type 同字段名。示例值:0
data.waf Integer / null WAF 状态,仅查询
data.frequency Integer 频率限制,仅查询。示例值:0
data.customRules Integer 自定义规则开关,type 同字段名。示例值:0
data.whitelist Integer 白名单开关,type 同字段名。示例值:0
data.ipWhitelist Integer 设置白名单开关,type 同字段名。示例值:0
data.blacklist Integer 黑名单,仅查询。示例值:0
data.sysRegion Integer 地区 / 国家限制开关,type 同字段名。示例值:0
data.ruleWhite Integer / null 规则白名单开关,type 同字段名
data.customPage Integer 自定义页面,仅查询。示例值:0
data.sslsupport Integer 证书开关,type 同字段名。示例值:1
data.bot Integer 搜索引擎开关,type 同字段名。示例值:0
data.https_301 Integer 强制跳转 HTTPS 开关,type 同字段名。示例值:1
data.webSocket Integer WebSocket 开关,type 同字段名。示例值:1
data.http2 Integer HTTP/2 开关,type 同字段名。示例值:1
data.rangeSource Integer Range 回源开关,type 同字段名。示例值:0
data.filterParameters Integer 过滤参数开关,type 同字段名。示例值:0

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限
查询失败:域名配置不可用 域名配置不可用
CDN10014 域名不存在
CDN10015 域名不属于你