查询域名基本信息¶
1. 接口描述¶
接口请求路径:GET /prod-api/cdn/domain/describeDomainBasic
describeDomainBasic 用于查询指定域名的基本信息,包括套餐、CNAME、源站配置等。
Token 获取方式见 密钥鉴权。
2. 输入参数¶
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| domainId | 是 | Integer | Query 参数。域名 ID 示例值: 657 |
3. 示例¶
示例1 查询域名基本信息¶
输入示例¶
代码调用¶
请将 {登录域名}、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 DescribeDomainBasicTest {
public static void main(String[] args) throws Exception {
String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";
URIBuilder uriBuilder = new URIBuilder("https://{登录域名}/prod-api/cdn/domain/describeDomainBasic");
uriBuilder.addParameter("domainId", "657");
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/describeDomainBasic")
if err != nil {
panic(err)
}
q := u.Query()
q.Set("domainId", "657")
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": 657,
"backUpSource": [],
"sourceType": 1,
"upstream": 2,
"domainName": "*.testpctl.hk",
"ip": "1.1.1.1",
"port": 0,
"cNamePre": "alldemourl.testpctl.hk",
"cNameSuf": ".ruisuyun.cn",
"resouceHost": "",
"doid": "20240412279097884616",
"customerRemark": "",
"setMealAlias": "c8f2451234658ddad2fbfa2eac4d",
"isIntermediateSource": "off",
"isActive": null,
"userId": null,
"adminRemark": null,
"origin": {
"httpOriginPort": 80,
"httpsOriginPort": 443,
"originGroupId": 1338,
"originType": "originGroup",
"originRecord": "",
"originProtocol": 0,
"records": [
{
"record": "1.1.1.1",
"weight": null
}
],
"originGroupName": "1_1_1_1"
},
"communicationIP": ["2.43.5.35", "8.1.4.176", "8.1.88.12"]
}
}
4. 输出参数¶
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | Integer | 状态码。示例值:200 |
| msg | String | 提示信息。示例值:成功 |
| data | Object | 域名基本信息 |
| data.domainId | Integer | 域名 ID。示例值:657 |
| data.domainName | String | 域名。示例值:*.testpctl.hk |
| data.port | Integer | 端口。示例值:0 |
| data.ip | String | 回源地址。示例值:1.1.1.1 |
| data.sourceType | Integer | 回源地址类型。取值:1(IP)、2(域名)。示例值:1 |
| data.backUpSource | Array of String | 备用源列表 |
| data.upstream | Integer | 负载均衡。取值:0(轮询)、2(会话保持)。示例值:2 |
| data.cNamePre | String | CNAME 前缀。示例值:alldemourl.testpctl.hk |
| data.cNameSuf | String | CNAME 后缀。示例值:.ruisuyun.cn |
| data.resouceHost | String | 回源 Host |
| data.doid | String | 所属套餐号。示例值:20240412279097884616 |
| data.setMealAlias | String | 套餐别名。示例值:c8f2451234658ddad2fbfa2eac4d |
| data.customerRemark | String | 备注 |
| data.isIntermediateSource | String | 是否开启中间源。取值:on、off。示例值:off |
| data.isActive | Integer | 域名状态。取值:0(配置中)、1(活跃/部署中)、2(暂停),可能为 null |
| data.userId | Integer | 用户 ID,可能为 null |
| data.adminRemark | String | 管理员备注,可能为 null |
| data.communicationIP | Array of String | 与源服务器通讯 IP 列表。示例值:["2.43.5.35","8.1.4.176","8.1.88.12"] |
| data.origin | DomainOriginRespVO | 源站配置 |
5. 错误码¶
| HTTP 状态码 / 业务提示 | 描述 |
|---|---|
| 200 | 成功 |
| 401 | 未鉴权或 Token 无效 |
| 403 | 无权限 |
| 查询失败:域名不存在 | 域名不存在 |
| 查询失败:域名不属于你 | 域名不属于当前账号 |
6. 数据模型¶
DomainOriginRespVO¶
源站配置。
| 参数名称 | 类型 | 描述 |
|---|---|---|
| originType | String | 源站类型。取值:ipDomain(IP)、originGroup(源站组)。示例值:originGroup |
| originRecord | String | 源站 IP。originType 为 ipDomain 时返回 |
| originGroupId | Integer | 源站组 ID。originType 为 originGroup 时返回。示例值:1338 |
| originGroupName | String | 源站组名称。示例值:1_1_1_1 |
| originProtocol | Integer | 源协议。取值:0(HTTP)、1(协议跟随)、2(HTTPS)。示例值:0 |
| httpOriginPort | Integer | HTTP 回源端口。示例值:80 |
| httpsOriginPort | Integer | HTTPS 回源端口。示例值:443 |
| records | [DomainOriginRecordVO] | 源站记录列表 |
DomainOriginRecordVO¶
源站记录。
| 参数名称 | 类型 | 描述 |
|---|---|---|
| record | String | 源站地址。示例值:1.1.1.1 |
| weight | Integer | 权重,可能为 null |