itecdn 5.x用户文档
itecdn 5.x / 用户 API

查询 DNS API 列表

GET/v1/dnsapis

分页查询 DNS 服务商凭据记录,按 ID 倒序返回。普通用户只能读取自己的记录并忽略 uid 筛选;管理员可用 uid 查询指定用户的记录。响应会直接返回数据库保存的 auth 文本,应避免在不可信环境展示或记录。

身份认证

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 同时发送。"
  }
}

请求参数

参数位置类型必填说明与约束
pagequeryinteger (int32)可选

页码,默认 1。服务端仅校验其为数字;分页偏移按 (page - 1) × limit 计算。

完整参数定义
{
  "name": "page",
  "in": "query",
  "required": false,
  "schema": {
    "type": "integer",
    "format": "int32"
  },
  "description": "页码,默认 1。服务端仅校验其为数字;分页偏移按 (page - 1) × limit 计算。",
  "example": 1
}
limitqueryinteger (int32)可选

每页记录数,默认 10;传 0 时取消 SQL limit 并返回全部记录。

完整参数定义
{
  "name": "limit",
  "in": "query",
  "required": false,
  "schema": {
    "type": "integer",
    "format": "int32",
    "minimum": 0
  },
  "description": "每页记录数,默认 10;传 0 时取消 SQL limit 并返回全部记录。",
  "example": 10
}
uidqueryinteger (int64)可选

仅管理员可用:筛选指定所属用户 ID。普通用户提供该参数不会改变查询范围。

完整参数定义
{
  "name": "uid",
  "in": "query",
  "required": false,
  "schema": {
    "type": "integer",
    "format": "int64",
    "minimum": 1
  },
  "description": "仅管理员可用:筛选指定所属用户 ID。普通用户提供该参数不会改变查询范围。",
  "example": 10001
}

响应

HTTP 200

业务结果使用 HTTP 200 返回。成功响应含 code、count、data,不含 msg 字段;分页参数或认证失败时返回业务错误封装。

application/json

oneOf

oneOf · 1 · object
字段类型必填说明与约束
codeinteger必填

成功状态码,固定为 0。

约束 / 默认值 / 示例
{
  "enum": [
    0
  ]
}
countinteger (int64)必填

当前权限与 uid 条件下的 DNS API 记录总数。

约束 / 默认值 / 示例
{
  "format": "int64",
  "minimum": 0
}
dataarray <object>必填

当前页 DNS API 记录,按 id 倒序排列。

展开字段结构

当前页 DNS API 记录,按 id 倒序排列。

数组元素 · object

DNS 服务商凭据记录。

字段类型必填说明与约束
idinteger (int64)必填

DNS API 记录 ID。

约束 / 默认值 / 示例
{
  "format": "int64"
}
uidinteger (int64)必填

凭据所属用户 ID。

约束 / 默认值 / 示例
{
  "format": "int64",
  "nullable": true
}
namestring必填

用户定义的 DNS API 名称。

约束 / 默认值 / 示例
{
  "nullable": true
}
desstring必填

凭据备注。

约束 / 默认值 / 示例
{
  "nullable": true
}
typestring必填

DNS 服务商类型,例如 CloudFlare、Aliyun 或 DNSPod.cn。

约束 / 默认值 / 示例
{
  "nullable": true
}
usernamestring必填

所属用户登录名;关联用户不存在时为 null。

约束 / 默认值 / 示例
{
  "nullable": true
}
authstring必填

数据库保存的 DNS 服务商鉴权 JSON 文本,包含 API Token、密钥或账号等敏感信息。服务端实际会返回此字段;文档示例已脱敏。

约束 / 默认值 / 示例
{
  "nullable": true
}
oneOf · 2 · object
字段类型必填说明与约束
codestring必填

分页参数错误或认证失效的业务错误码。

约束 / 默认值 / 示例
{
  "enum": [
    "dnsapi-5",
    "dnsapi-6",
    "login_required"
  ]
}
msgstring必填

分页参数或认证失败原因。

datastring必填

业务错误时固定为空字符串。

约束 / 默认值 / 示例
{
  "enum": [
    ""
  ]
}
完整 Schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "code",
        "count",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "enum": [
            0
          ],
          "description": "成功状态码,固定为 0。"
        },
        "count": {
          "type": "integer",
          "format": "int64",
          "minimum": 0,
          "description": "当前权限与 uid 条件下的 DNS API 记录总数。"
        },
        "data": {
          "type": "array",
          "description": "当前页 DNS API 记录,按 id 倒序排列。",
          "items": {
            "type": "object",
            "required": [
              "id",
              "uid",
              "name",
              "des",
              "type",
              "username",
              "auth"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "format": "int64",
                "description": "DNS API 记录 ID。"
              },
              "uid": {
                "type": "integer",
                "format": "int64",
                "nullable": true,
                "description": "凭据所属用户 ID。"
              },
              "name": {
                "type": "string",
                "nullable": true,
                "description": "用户定义的 DNS API 名称。"
              },
              "des": {
                "type": "string",
                "nullable": true,
                "description": "凭据备注。"
              },
              "type": {
                "type": "string",
                "nullable": true,
                "description": "DNS 服务商类型,例如 CloudFlare、Aliyun 或 DNSPod.cn。"
              },
              "username": {
                "type": "string",
                "nullable": true,
                "description": "所属用户登录名;关联用户不存在时为 null。"
              },
              "auth": {
                "type": "string",
                "nullable": true,
                "description": "数据库保存的 DNS 服务商鉴权 JSON 文本,包含 API Token、密钥或账号等敏感信息。服务端实际会返回此字段;文档示例已脱敏。"
              }
            },
            "additionalProperties": false,
            "description": "DNS 服务商凭据记录。"
          }
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "dnsapi-5",
            "dnsapi-6",
            "login_required"
          ],
          "description": "分页参数错误或认证失效的业务错误码。"
        },
        "msg": {
          "type": "string",
          "description": "分页参数或认证失败原因。"
        },
        "data": {
          "type": "string",
          "enum": [
            ""
          ],
          "description": "业务错误时固定为空字符串。"
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "count": 1,
  "data": [
    {
      "id": 3001,
      "uid": 10001,
      "name": "生产 DNS",
      "des": "证书自动签发",
      "type": "CloudFlare",
      "username": "demo-user",
      "auth": "{\"CF_Email\":\"admin@example.invalid\",\"CF_Key\":\"REDACTED\"}"
    }
  ]
}

cURL 示例

根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。

curl --request GET \
  "https://master.example.invalid/v1/dnsapis" \
  --header "access-token: YOUR_ACCESS_TOKEN"

查看完整接口 JSON