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

获取自己的 DNS 服务商凭据详情

GET/v1/dnsapis/{api_id}

按 ID 读取当前登录用户自己创建的 DNS API 凭据。查询条件始终同时匹配 id 和当前用户 ID,因此管理员也不能通过该接口读取其他用户的详情;记录不存在或不归属当前用户时均返回 dnsapi-4。响应包含敏感 auth JSON 文本。

身份认证

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

请求参数

参数位置类型必填说明与约束
api_idpathinteger (int64)必填

要读取的 DNS API 记录 ID。

完整参数定义
{
  "name": "api_id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "integer",
    "format": "int64",
    "minimum": 1
  },
  "description": "要读取的 DNS API 记录 ID。",
  "example": 3001
}

响应

HTTP 200

业务结果使用 HTTP 200 返回。成功时返回 dnsapi 表完整记录;记录不存在、不归属当前用户或认证失效时返回业务错误码。

application/json

oneOf

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

成功状态码,固定为 0。

约束 / 默认值 / 示例
{
  "enum": [
    0
  ]
}
msgstring必填

详情读取成功时固定为空字符串。

约束 / 默认值 / 示例
{
  "enum": [
    ""
  ]
}
dataobject必填

dnsapi 表的完整凭据记录。

约束 / 默认值 / 示例
{
  "required": [
    "id",
    "uid",
    "name",
    "des",
    "type",
    "auth"
  ],
  "additionalProperties": false
}
展开字段结构

dnsapi 表的完整凭据记录。

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

DNS API 记录 ID。

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

凭据所属用户 ID,固定为当前登录用户。

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

用户定义的凭据名称。

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

凭据备注。

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

DNS 服务商类型。

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

数据库保存的服务商鉴权 JSON 文本,含敏感 Token、密钥或账号信息。文档示例已脱敏。

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

记录不存在/不归属当前用户或认证失效的业务错误码。

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

读取或认证失败原因。

datastring必填

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

约束 / 默认值 / 示例
{
  "enum": [
    ""
  ]
}
完整 Schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "enum": [
            0
          ],
          "description": "成功状态码,固定为 0。"
        },
        "msg": {
          "type": "string",
          "enum": [
            ""
          ],
          "description": "详情读取成功时固定为空字符串。"
        },
        "data": {
          "type": "object",
          "required": [
            "id",
            "uid",
            "name",
            "des",
            "type",
            "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": "用户定义的凭据名称。"
            },
            "des": {
              "type": "string",
              "nullable": true,
              "description": "凭据备注。"
            },
            "type": {
              "type": "string",
              "nullable": true,
              "description": "DNS 服务商类型。"
            },
            "auth": {
              "type": "string",
              "nullable": true,
              "description": "数据库保存的服务商鉴权 JSON 文本,含敏感 Token、密钥或账号信息。文档示例已脱敏。"
            }
          },
          "additionalProperties": false,
          "description": "dnsapi 表的完整凭据记录。"
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "dnsapi-4",
            "login_required"
          ],
          "description": "记录不存在/不归属当前用户或认证失效的业务错误码。"
        },
        "msg": {
          "type": "string",
          "description": "读取或认证失败原因。"
        },
        "data": {
          "type": "string",
          "enum": [
            ""
          ],
          "description": "业务错误时固定为空字符串。"
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "msg": "",
  "data": {
    "id": 3001,
    "uid": 10001,
    "name": "生产 Cloudflare",
    "des": "自动签发证书",
    "type": "CloudFlare",
    "auth": "{\"CF_Email\":\"admin@example.invalid\",\"CF_Key\":\"REDACTED\"}"
  }
}

cURL 示例

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

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

查看完整接口 JSON