itecdn 5.x / 用户 API
批量创建域名 DNS 记录同步任务
POST
/v1/domains为一个或多个现有网站域名创建“域名 DNS 记录同步”任务并将 task_id 写回域名记录。请求体必须是数组;普通用户只能同步自己的域名,管理员可用每项 uid 指定或代管用户。每个域名必须已配置 DNS API,否则不会创建同步任务。
身份认证
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 同时发送。"
}
}请求参数
未定义路径、查询或请求头参数。
请求体 · 必填
application/json
array <object>
需要创建 DNS 记录同步任务的域名项数组。空数组按服务端会直接成功返回但不会创建任务。
数组元素 · object
单个域名 DNS 同步任务请求项。
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
id | oneOf | 必填 | 要同步的 domain 记录 ID。 展开字段结构要同步的 domain 记录 ID。 oneOf · 1 · integer (int64)oneOf · 2 · string |
uid | integer (int64) | 可选 | 可选域名所属用户 ID。仅管理员可提交;用于代管指定用户的域名。 约束 / 默认值 / 示例 |
完整 Schema
{
"type": "array",
"description": "需要创建 DNS 记录同步任务的域名项数组。空数组按服务端会直接成功返回但不会创建任务。",
"items": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"oneOf": [
{
"type": "integer",
"format": "int64",
"minimum": 1
},
{
"type": "string",
"pattern": "^[0-9]+$"
}
],
"description": "要同步的 domain 记录 ID。"
},
"uid": {
"type": "integer",
"format": "int64",
"minimum": 1,
"description": "可选域名所属用户 ID。仅管理员可提交;用于代管指定用户的域名。"
}
},
"additionalProperties": false,
"description": "单个域名 DNS 同步任务请求项。"
},
"example": [
{
"id": 9001
},
{
"id": 9002
}
]
}请求体示例
[
{
"id": 9001
},
{
"id": 9002
}
]响应
HTTP 200
业务结果使用 HTTP 200 返回。成功时表示所有请求项的同步任务已发送,data 为 null;请求体格式、域名 ID/归属、DNS API 配置、权限或认证失败时返回业务错误码,并回滚本次批量操作。
application/json
oneOf
oneOf · 1 · object
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
code | integer | 必填 | 成功状态码,固定为 0。 约束 / 默认值 / 示例 |
msg | string | 必填 | 全部域名同步任务发送成功提示。 约束 / 默认值 / 示例 |
data | object | 必填 | 成功时固定为 null。 约束 / 默认值 / 示例 |
oneOf · 2 · object
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
code | string | 必填 | 请求体格式、域名 ID/归属、DNS API 配置、管理员权限或认证失败的业务错误码。 约束 / 默认值 / 示例 |
msg | string | 必填 | 批量同步任务创建失败原因。 |
data | string | 必填 | 业务错误时固定为空字符串。 约束 / 默认值 / 示例 |
完整 Schema
{
"oneOf": [
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "integer",
"enum": [
0
],
"description": "成功状态码,固定为 0。"
},
"msg": {
"type": "string",
"enum": [
"任务发送成功"
],
"description": "全部域名同步任务发送成功提示。"
},
"data": {
"type": "object",
"nullable": true,
"additionalProperties": false,
"description": "成功时固定为 null。"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "string",
"enum": [
"domain-1",
"domain-4",
"domain-5",
"domain-6",
"domain-7",
"domain-8",
"domain-9",
"login_required"
],
"description": "请求体格式、域名 ID/归属、DNS API 配置、管理员权限或认证失败的业务错误码。"
},
"msg": {
"type": "string",
"description": "批量同步任务创建失败原因。"
},
"data": {
"type": "string",
"enum": [
""
],
"description": "业务错误时固定为空字符串。"
}
},
"additionalProperties": false
}
]
}示例
{
"code": 0,
"msg": "任务发送成功",
"data": null
}cURL 示例
根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。
curl --request POST \
"https://master.example.invalid/v1/domains" \
--header "access-token: YOUR_ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '[{"id": 9001}, {"id": 9002}]'