{
  "tags": [
    "网站分组"
  ],
  "description": "创建网站组。默认归属当前登录用户，并先按当前用户的网站关联资源配额检查网站组数量；管理员可通过 `uid` 指定网站组归属用户。网站组名称在同一归属用户下必须唯一。",
  "operationId": "user_post_v1_site_groups",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "网站组创建成功，`data` 为新记录的自增 ID。 未登录、维护模式限制、网站组配额已满、非管理员指定 uid 或名称校验失败时仍返回 HTTP 200。`code` 可能为 `login_required`、`maintain`、`site_group-8`、`site_group-9`、`site_group-11`、`site_group-12` 或 `site_group-17`。",
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "enum": [
                      0
                    ],
                    "description": "业务状态码；0 表示成功。"
                  },
                  "msg": {
                    "type": "string",
                    "description": "业务提示。",
                    "example": "网站组添加成功"
                  },
                  "data": {
                    "type": "integer",
                    "description": "新创建网站组的自增 ID。",
                    "example": 21
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "业务错误码。",
                    "example": "site_group-8"
                  },
                  "msg": {
                    "type": "string",
                    "description": "错误原因。",
                    "example": "当前添加的网站组已超限"
                  },
                  "data": {
                    "type": "string",
                    "description": "错误响应中的固定空字符串。",
                    "example": ""
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "examples": {
            "success": {
              "summary": "成功响应",
              "value": {
                "code": 0,
                "msg": "网站组添加成功",
                "data": 21
              }
            },
            "businessError": {
              "summary": "业务错误响应",
              "value": {
                "code": "site_group-8",
                "msg": "当前添加的网站组已超限",
                "data": ""
              }
            }
          },
          "example": {
            "code": 0,
            "msg": "网站组添加成功",
            "data": 21
          }
        }
      }
    }
  },
  "x-python-handler": "site.SiteGroupAPI",
  "x-python-route-line": 625,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "name"
          ],
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "description": "网站组名称，不能为空；服务端会进行 XSS 过滤，且在归属用户下必须唯一。",
              "example": "生产网站"
            },
            "des": {
              "type": "string",
              "description": "网站组备注；服务端会进行 XSS 过滤，未传时保存为空字符串。",
              "example": "主要业务站点"
            },
            "uid": {
              "type": "integer",
              "minimum": 1,
              "description": "仅管理员可传。创建后的网站组归属用户 ID；未传时使用当前登录用户 ID。",
              "example": 12
            }
          },
          "additionalProperties": false
        },
        "example": {
          "name": "生产网站",
          "des": "主要业务站点"
        }
      }
    }
  },
  "parameters": [],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "site.SiteGroupAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 625
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "post",
  "path": "/v1/site-groups",
  "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": "生产网站",
    "des": "主要业务站点",
    "uid": 12
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "新增网站组",
    "description": {
      "content": "创建网站组。默认归属当前登录用户，并先按当前用户的网站关联资源配额检查网站组数量；管理员可通过 `uid` 指定网站组归属用户。网站组名称在同一归属用户下必须唯一。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "site-groups"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [],
      "variable": []
    },
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "POST",
    "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"
        }
      ]
    }
  }
}