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

删除一个或多个证书

DELETE/v1/certs/{cert_id}

删除路径中指定的一个或多个证书,多个 ID 使用英文逗号分隔并在同一事务中处理。普通用户只能删除自己的证书,管理员可删除其他用户证书。每个证书必须已禁用,且关联任务为空或状态为 done;任一目标失败时整批回滚。

身份认证

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

请求参数

参数位置类型必填说明与约束
cert_idpathstring必填

要删除的证书 ID;多个 ID 按 10021,10022 形式用英文逗号连接,每段必须为十进制数字。

完整参数定义
{
  "name": "cert_id",
  "in": "path",
  "required": true,
  "description": "要删除的证书 ID;多个 ID 按 10021,10022 形式用英文逗号连接,每段必须为十进制数字。",
  "schema": {
    "type": "string",
    "pattern": "^[0-9]+(?:,[0-9]+)*$"
  },
  "example": "10021,10022"
}

响应

HTTP 200

业务结果通过 HTTP 200 返回。全部目标删除并提交后返回确认消息;ID、记录、权限、启用状态、任务状态、维护或认证校验失败返回业务错误码,事务回滚。

application/json

oneOf

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

删除成功状态码,固定为 0。

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

证书删除批次成功消息。

约束 / 默认值 / 示例
{
  "enum": [
    "证书删除成功"
  ]
}
datastring必填

删除成功时固定为 null。

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

业务错误码:1 表示 ID 格式错误,2 表示证书不存在,3 表示证书仍启用,4 表示证书任务尚未完成,47 表示普通用户删除其他用户证书,maintain 和 login_required 表示维护或认证失败。

约束 / 默认值 / 示例
{
  "enum": [
    "cert-1",
    "cert-2",
    "cert-3",
    "cert-4",
    "cert-47",
    "maintain",
    "login_required"
  ]
}
msgstring必填

与业务错误码对应的中文 ID、记录、状态、权限或认证失败原因。

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": "string",
          "nullable": true,
          "enum": [
            null
          ],
          "description": "删除成功时固定为 null。"
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "cert-1",
            "cert-2",
            "cert-3",
            "cert-4",
            "cert-47",
            "maintain",
            "login_required"
          ],
          "description": "业务错误码:1 表示 ID 格式错误,2 表示证书不存在,3 表示证书仍启用,4 表示证书任务尚未完成,47 表示普通用户删除其他用户证书,maintain 和 login_required 表示维护或认证失败。"
        },
        "msg": {
          "type": "string",
          "description": "与业务错误码对应的中文 ID、记录、状态、权限或认证失败原因。"
        },
        "data": {
          "type": "string",
          "enum": [
            ""
          ],
          "description": "业务错误时固定为空字符串。"
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "msg": "证书删除成功",
  "data": null
}

cURL 示例

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

curl --request DELETE \
  "https://master.example.invalid/v1/certs/{cert_id}" \
  --header "access-token: YOUR_ACCESS_TOKEN"

查看完整接口 JSON