查询网站域名与 DNS 同步状态
/v1/domains分页查询网站绑定的域名及其 CNAME、DNS API 和同步任务状态,按域名记录 ID 倒序返回。普通用户只可查询自己的域名,管理员可用 uid 查询指定用户。domain 使用包含匹配;limit=0 时返回全部匹配记录。
身份认证
access-token
api-key + api-secret
认证定义
{
"AccessToken": {
"type": "apiKey",
"in": "header",
"name": "access-token",
"description": "通过登录接口获得的短期访问令牌。"
},
"ApiKey": {
"type": "apiKey",
"in": "header",
"name": "api-key",
"description": "API Key;必须和 api-secret 同时发送。"
},
"ApiSecret": {
"type": "apiKey",
"in": "header",
"name": "api-secret",
"description": "API Secret;必须和 api-key 同时发送。"
}
}请求参数
| 参数 | 位置 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|---|
page | query | integer (int32) | 可选 | 页码,默认 1。服务端仅校验其为数字;分页偏移按 (page - 1) × limit 计算。 完整参数定义 |
limit | query | integer (int32) | 可选 | 每页记录数,默认 10;传 0 时取消 SQL limit。 完整参数定义 |
uid | query | integer (int64) | 可选 | 仅管理员可用:筛选网站所属用户 ID。普通用户提供该参数不会改变查询范围。 完整参数定义 |
domain | query | string | 可选 | 按域名进行包含匹配,不是精确匹配。 完整参数定义 |
site_id | query | integer (int64) | 可选 | 精确筛选所属网站 ID。 完整参数定义 |
dnsapi_state | query | string | 可选 | DNS API 设置状态:set 仅返回已设置 s.dns_api 的网站域名,not_set 仅返回未设置的。其他值不会增加筛选条件。 完整参数定义 |
task_state | query | string | 可选 | 精确筛选关联域名 DNS 同步任务的 state 值。 完整参数定义 |
响应
HTTP 200
业务结果使用 HTTP 200 返回。成功响应含 code、count、data,不含 msg 字段;分页参数或认证失败时返回业务错误封装。
application/json
oneOf
oneOf · 1 · object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 成功状态码,固定为 0。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||
count | integer (int64) | 必填 | 当前权限和筛选条件下的域名记录总数。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||
data | array <object> | 必填 | 当前页域名记录,按 domain.id 倒序排列。 展开字段结构当前页域名记录,按 domain.id 倒序排列。 数组元素 · object 网站域名及 DNS 同步状态记录。
|
oneOf · 2 · object
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
code | string | 必填 | 分页参数错误或认证失效的业务错误码。 约束 / 默认值 / 示例 |
msg | string | 必填 | 分页参数或认证失败原因。 |
data | string | 必填 | 业务错误时固定为空字符串。 约束 / 默认值 / 示例 |
完整 Schema
{
"oneOf": [
{
"type": "object",
"required": [
"code",
"count",
"data"
],
"properties": {
"code": {
"type": "integer",
"enum": [
0
],
"description": "成功状态码,固定为 0。"
},
"count": {
"type": "integer",
"format": "int64",
"minimum": 0,
"description": "当前权限和筛选条件下的域名记录总数。"
},
"data": {
"type": "array",
"description": "当前页域名记录,按 domain.id 倒序排列。",
"items": {
"type": "object",
"required": [
"username",
"uid",
"id",
"site_id",
"domain",
"cname",
"dns_api",
"state",
"ret"
],
"properties": {
"username": {
"type": "string",
"nullable": true,
"description": "网站所属用户登录名。"
},
"uid": {
"type": "integer",
"format": "int64",
"nullable": true,
"description": "网站所属用户 ID。"
},
"id": {
"type": "integer",
"format": "int64",
"description": "域名记录 ID。"
},
"site_id": {
"type": "integer",
"format": "int64",
"nullable": true,
"description": "所属网站 ID。"
},
"domain": {
"type": "string",
"description": "网站绑定的域名。"
},
"cname": {
"type": "string",
"nullable": true,
"description": "根据网站 cname_mode 及其 CNAME 域名配置计算出的完整 CNAME 目标。"
},
"dns_api": {
"type": "integer",
"format": "int64",
"nullable": true,
"description": "网站关联的 DNS API 凭据 ID;null 表示尚未设置。"
},
"state": {
"type": "string",
"nullable": true,
"description": "关联域名 DNS 同步任务状态;无任务时为 null。"
},
"ret": {
"type": "string",
"nullable": true,
"description": "关联域名 DNS 同步任务返回内容;无任务时为 null。"
}
},
"additionalProperties": false,
"description": "网站域名及 DNS 同步状态记录。"
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "string",
"enum": [
"domain-2",
"domain-3",
"login_required"
],
"description": "分页参数错误或认证失效的业务错误码。"
},
"msg": {
"type": "string",
"description": "分页参数或认证失败原因。"
},
"data": {
"type": "string",
"enum": [
""
],
"description": "业务错误时固定为空字符串。"
}
},
"additionalProperties": false
}
]
}示例
{
"code": 0,
"count": 1,
"data": [
{
"username": "demo-user",
"uid": 10001,
"id": 9001,
"site_id": 5001,
"domain": "www.example.com",
"cname": "site-a.cname.example.invalid",
"dns_api": 3001,
"state": "pending",
"ret": null
}
]
}cURL 示例
根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。
curl --request GET \
"https://master.example.invalid/v1/domains" \
--header "access-token: YOUR_ACCESS_TOKEN"