{
  "tags": [
    "DNS 管理"
  ],
  "description": "更新指定 DNS API 凭据的已提交字段；路径 api_id 会覆盖请求体中的 id。普通用户只能更新自己的记录，管理员可以更新任意记录；管理员可额外传 uid 进行归属校验。所有业务字段可选，未提交字段保持原值，且没有实际变更时接口仍成功返回。若提交 auth，服务端按当前或提交后的 type 校验所需服务商键。",
  "operationId": "user_put_v1_dnsapis_api_id",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "业务结果使用 HTTP 200 返回。成功时 data 为 null（包括没有实际字段变化时）；记录、归属、字段、鉴权键、管理员权限或认证校验失败时返回业务错误码。",
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "enum": [
                      0
                    ],
                    "description": "成功状态码，固定为 0。"
                  },
                  "msg": {
                    "type": "string",
                    "enum": [
                      "更新dnsapi成功"
                    ],
                    "description": "更新成功提示。"
                  },
                  "data": {
                    "type": "object",
                    "nullable": true,
                    "additionalProperties": false,
                    "description": "成功时固定为 null。"
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "业务错误码，包括记录/归属/字段/鉴权键错误 dnsapi-7 至 dnsapi-38、管理员权限错误 dnsapi-36、dnsapi-37 及认证错误 login_required。"
                  },
                  "msg": {
                    "type": "string",
                    "description": "记录、归属、字段、鉴权键、权限或认证失败原因。"
                  },
                  "data": {
                    "type": "string",
                    "enum": [
                      ""
                    ],
                    "description": "业务错误时固定为空字符串。"
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "example": {
            "code": 0,
            "msg": "更新dnsapi成功",
            "data": null
          }
        }
      }
    }
  },
  "x-python-handler": "site.DNSAPI",
  "x-python-route-line": 351,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "api_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "integer",
        "format": "int64",
        "minimum": 1
      },
      "description": "要更新的 DNS API 记录 ID。",
      "example": 3001
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "uid": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "description": "可选所属用户 ID。仅管理员可提交；更新时实际归属仍须与现有记录一致，否则要求管理员权限。"
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "description": "可选新凭据名称。服务端过滤 XSS；提供时不能为空且同一所属用户下不能重名。"
            },
            "des": {
              "type": "string",
              "description": "可选新备注。服务端过滤 XSS；可传空字符串清空。"
            },
            "type": {
              "type": "string",
              "enum": [
                "huaweicloud.com",
                "CloudFlare",
                "DNSPod.cn",
                "DNSPod.com",
                "GoDaddy.com",
                "Aliyun",
                "cloudns.net",
                "Name.com",
                "Namecheap",
                "jdcloud.com",
                "dnsdun",
                "DNS.LA",
                "Namesilo.com",
                "DNS.COM"
              ],
              "description": "可选新 DNS 服务商类型。仅改 type 而不提交 auth 时，服务端不会重新校验原有 auth。"
            },
            "auth": {
              "type": "object",
              "minProperties": 1,
              "additionalProperties": {
                "type": "string"
              },
              "description": "可选新服务商鉴权对象。提交时按当前或新 type 校验键：CloudFlare=CF_Key、CF_Email；DNSPod.cn=DP_Id、DP_Key；DNSPod.com=DPI_Id、DPI_Key；GoDaddy.com=GD_Key、GD_Secret；Aliyun=Ali_Key、Ali_Secret；cloudns.net=CLOUDNS_SUB_AUTH_ID、CLOUDNS_AUTH_PASSWORD；Name.com=Namecom_Username、Namecom_Token；Namecheap=NAMECHEAP_USERNAME、NAMECHEAP_API_KEY、NAMECHEAP_SOURCEIP；jdcloud.com=JD_ACCESS_KEY_ID、JD_ACCESS_KEY_SECRET；dnsdun=Dnsdun_uid、Dnsdun_api_key；huaweicloud.com=huaweicloud_access_key_id、huaweicloud_serect_access_key；DNS.LA=LA_Ak、LA_Sk；Namesilo.com=Namesilo_Key；DNS.COM 仅要求非空对象。所有值均为敏感凭据。"
            }
          },
          "additionalProperties": false,
          "example": {
            "name": "生产 Cloudflare（新）",
            "auth": {
              "CF_Email": "admin@example.invalid",
              "CF_Key": "REDACTED"
            }
          }
        }
      }
    }
  },
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "site.DNSAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 351
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "put",
  "path": "/v1/dnsapis/{api_id}",
  "servers": [
    {
      "url": "https://master.example.invalid",
      "description": "不可调用的示例地址；复制示例后替换为自己的主控域名。"
    }
  ],
  "securitySchemes": {
    "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 同时发送。"
    }
  },
  "jsonRequestBodyExample": {
    "name": "生产 Cloudflare（新）",
    "auth": {
      "CF_Email": "admin@example.invalid",
      "CF_Key": "REDACTED"
    }
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "更新 DNS 服务商凭据",
    "description": {
      "content": "更新指定 DNS API 凭据的已提交字段；路径 api_id 会覆盖请求体中的 id。普通用户只能更新自己的记录，管理员可以更新任意记录；管理员可额外传 uid 进行归属校验。所有业务字段可选，未提交字段保持原值，且没有实际变更时接口仍成功返回。若提交 auth，服务端按当前或提交后的 type 校验所需服务商键。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "dnsapis",
        ":api_id"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [],
      "variable": [
        {
          "disabled": false,
          "description": {
            "content": "(Required) 要更新的 DNS API 记录 ID。",
            "type": "text/plain"
          },
          "type": "any",
          "value": "",
          "key": "api_id"
        }
      ]
    },
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "PUT",
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}