{
  "tags": [
    "网站管理"
  ],
  "description": "获取指定网站的完整配置、套餐、线路和任务状态。普通用户只能读取自己的网站；读取其他用户的网站需要管理员权限。配置类字段按数据库原值返回，其中多项为 JSON 字符串，调用方需要自行解析。",
  "operationId": "user_get_v1_sites_site_id",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "请求已被处理。成功时 `code` 为 0，`data` 为网站详情；网站不存在或无权限时仍返回 HTTP 200 并提供业务错误码。",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "code",
              "msg",
              "data"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "description": "业务状态码；成功为 0。",
                "example": 0
              },
              "msg": {
                "type": "string",
                "description": "成功时为空字符串，失败时为错误说明。",
                "example": ""
              },
              "data": {
                "type": "object",
                "description": "网站详情。JSON 配置字段以字符串形式返回。",
                "required": [
                  "id",
                  "uid",
                  "domain",
                  "backend",
                  "user_package",
                  "enable",
                  "site_state"
                ],
                "properties": {
                  "id": {
                    "type": "integer",
                    "description": "网站 ID。"
                  },
                  "uid": {
                    "type": "integer",
                    "description": "网站归属用户 ID。"
                  },
                  "name": {
                    "type": "string",
                    "description": "归属用户名。"
                  },
                  "domain": {
                    "type": "string",
                    "description": "网站域名，多个域名以空白字符分隔。"
                  },
                  "backend": {
                    "type": "string",
                    "description": "源站列表的 JSON 字符串；每项包含 addr、weight、state。"
                  },
                  "backend_host": {
                    "type": "string",
                    "description": "回源 Host 配置。"
                  },
                  "backend_protocol": {
                    "type": "string",
                    "description": "回源协议：follow、http 或 https。"
                  },
                  "backend_http_port": {
                    "type": "integer",
                    "description": "HTTP 回源端口。"
                  },
                  "backend_https_port": {
                    "type": "integer",
                    "description": "HTTPS 回源端口。"
                  },
                  "backend_port_mapping": {
                    "type": "integer",
                    "description": "是否启用回源端口映射。"
                  },
                  "balance_way": {
                    "type": "string",
                    "description": "负载均衡方式。"
                  },
                  "http_listen": {
                    "type": "string",
                    "description": "HTTP 监听配置的 JSON 字符串。"
                  },
                  "https_listen": {
                    "type": "string",
                    "description": "HTTPS 监听配置的 JSON 字符串。"
                  },
                  "user_package": {
                    "type": "integer",
                    "description": "使用的用户套餐 ID。"
                  },
                  "package_id": {
                    "type": "integer",
                    "description": "底层套餐 ID。"
                  },
                  "package_name": {
                    "type": "string",
                    "description": "用户套餐名称。"
                  },
                  "end_at": {
                    "type": "string",
                    "nullable": true,
                    "description": "用户套餐到期时间，格式为 YYYY-MM-DD HH:mm:ss。"
                  },
                  "region_id": {
                    "type": "integer",
                    "description": "区域 ID。"
                  },
                  "region_name": {
                    "type": "string",
                    "description": "区域名称。"
                  },
                  "node_group_id": {
                    "type": "integer",
                    "description": "主线路组 ID。"
                  },
                  "node_group_name": {
                    "type": "string",
                    "description": "主线路组名称。"
                  },
                  "node_group_ipv6": {
                    "type": "integer",
                    "enum": [
                      0,
                      1
                    ],
                    "description": "主线路组是否含 IPv6 节点。"
                  },
                  "backup_node_group": {
                    "type": "integer",
                    "nullable": true,
                    "description": "备用线路组 ID。"
                  },
                  "backup_node_group_name": {
                    "type": "string",
                    "nullable": true,
                    "description": "备用线路组名称。"
                  },
                  "cname_mode": {
                    "type": "string",
                    "description": "CNAME 使用方式。"
                  },
                  "cname_hostname": {
                    "type": "string",
                    "description": "网站 CNAME 主机名。"
                  },
                  "cname_domain": {
                    "type": "string",
                    "nullable": true,
                    "description": "网站 CNAME 域名。"
                  },
                  "up_cname_domain": {
                    "type": "string",
                    "nullable": true,
                    "description": "套餐 CNAME 域名。"
                  },
                  "up_cname_hostname": {
                    "type": "string",
                    "nullable": true,
                    "description": "套餐 CNAME 主机名。"
                  },
                  "enable": {
                    "type": "integer",
                    "enum": [
                      0,
                      1
                    ],
                    "description": "网站是否启用。"
                  },
                  "site_state": {
                    "type": "string",
                    "description": "网站当前状态。"
                  },
                  "sync_state": {
                    "type": "string",
                    "nullable": true,
                    "description": "网站同步任务状态。"
                  },
                  "cname_state": {
                    "type": "string",
                    "nullable": true,
                    "description": "CNAME 任务状态。"
                  },
                  "task_id": {
                    "type": "integer",
                    "nullable": true,
                    "description": "网站同步任务 ID。"
                  },
                  "cname_task_id": {
                    "type": "integer",
                    "nullable": true,
                    "description": "CNAME 任务 ID。"
                  },
                  "groups": {
                    "type": "string",
                    "nullable": true,
                    "description": "网站分组 ID 的逗号分隔字符串。"
                  },
                  "group_name": {
                    "type": "string",
                    "nullable": true,
                    "description": "网站分组名称的逗号分隔字符串。"
                  },
                  "health_check": {
                    "type": "string",
                    "description": "健康检查配置的 JSON 字符串。"
                  },
                  "proxy_timeout": {
                    "type": "integer",
                    "description": "回源读取超时秒数。"
                  },
                  "proxy_connect_timeout": {
                    "type": "integer",
                    "description": "回源连接超时秒数。"
                  },
                  "proxy_auth": {
                    "type": "string",
                    "description": "回源认证配置的 JSON 字符串。"
                  },
                  "proxy_cache": {
                    "type": "integer",
                    "description": "是否启用代理缓存。"
                  },
                  "proxy_http_version": {
                    "type": "string",
                    "description": "回源 HTTP 版本。"
                  },
                  "proxy_ssl_protocols": {
                    "type": "string",
                    "description": "回源 TLS 协议配置。"
                  },
                  "gzip_enable": {
                    "type": "integer",
                    "description": "是否启用 Gzip。"
                  },
                  "gzip_types": {
                    "type": "string",
                    "description": "Gzip MIME 类型。"
                  },
                  "websocket_enable": {
                    "type": "integer",
                    "description": "是否启用 WebSocket。"
                  },
                  "cors": {
                    "type": "string",
                    "description": "跨域配置的 JSON 字符串。"
                  },
                  "hotlink": {
                    "type": "string",
                    "description": "防盗链配置的 JSON 字符串。"
                  },
                  "acl": {
                    "type": "string",
                    "nullable": true,
                    "description": "访问控制列表配置。"
                  },
                  "black_ip": {
                    "type": "string",
                    "description": "IP 黑名单配置。"
                  },
                  "white_ip": {
                    "type": "string",
                    "description": "IP 白名单配置。"
                  },
                  "block_proxy": {
                    "type": "integer",
                    "description": "是否拦截代理请求。"
                  },
                  "block_region": {
                    "type": "string",
                    "description": "地域拦截配置。"
                  },
                  "cc_default_rule": {
                    "type": "string",
                    "description": "默认 CC 防护规则 ID。"
                  },
                  "cc_switch": {
                    "type": "string",
                    "description": "CC 开关配置的 JSON 字符串。"
                  },
                  "condition_backend": {
                    "type": "string",
                    "description": "条件回源配置的 JSON 字符串。"
                  },
                  "extra_cc_rule": {
                    "type": "string",
                    "description": "附加 CC 规则配置。"
                  },
                  "req_header": {
                    "type": "string",
                    "description": "请求头改写配置。"
                  },
                  "resp_header": {
                    "type": "string",
                    "description": "响应头改写配置。"
                  },
                  "url_rewrite": {
                    "type": "string",
                    "description": "URL 重写配置。"
                  },
                  "page_403": {
                    "type": "string",
                    "description": "403 页面配置。"
                  },
                  "page_404": {
                    "type": "string",
                    "description": "404 页面配置。"
                  },
                  "page_500": {
                    "type": "string",
                    "description": "500 页面配置。"
                  },
                  "page_502": {
                    "type": "string",
                    "description": "502 页面配置。"
                  },
                  "page_504": {
                    "type": "string",
                    "description": "504 页面配置。"
                  },
                  "create_at2": {
                    "type": "string",
                    "description": "创建时间，格式为 YYYY-MM-DD HH:mm:ss。"
                  },
                  "update_at2": {
                    "type": "string",
                    "description": "更新时间，格式为 YYYY-MM-DD HH:mm:ss。"
                  },
                  "version": {
                    "type": "integer",
                    "description": "配置版本号。"
                  }
                }
              }
            }
          },
          "examples": {
            "success": {
              "summary": "查询成功",
              "value": {
                "code": 0,
                "msg": "",
                "data": {
                  "id": 101,
                  "uid": 12,
                  "domain": "www.example.invalid",
                  "backend": "[{\"addr\": \"198.51.100.10\", \"weight\": 1, \"state\": \"up\"}]",
                  "user_package": 8,
                  "enable": 1,
                  "site_state": "done"
                }
              }
            },
            "notFound": {
              "summary": "网站不存在",
              "value": {
                "code": "site-127",
                "msg": "网站不存在",
                "data": ""
              }
            }
          },
          "example": {
            "code": 0,
            "msg": "",
            "data": {
              "id": 101,
              "uid": 12,
              "domain": "www.example.invalid",
              "backend": "[{\"addr\": \"198.51.100.10\", \"weight\": 1, \"state\": \"up\"}]",
              "user_package": 8,
              "enable": 1,
              "site_state": "done"
            }
          }
        }
      }
    }
  },
  "x-python-handler": "site.SiteAPI",
  "x-python-route-line": 568,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "site_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "integer"
      },
      "description": "要查询的网站 ID，必须是当前用户的网站；管理员可查询任意已有网站。"
    }
  ],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "site.SiteAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 568
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "get",
  "path": "/v1/sites/{site_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 同时发送。"
    }
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "获取网站详情",
    "description": {
      "content": "获取指定网站的完整配置、套餐、线路和任务状态。普通用户只能读取自己的网站；读取其他用户的网站需要管理员权限。配置类字段按数据库原值返回，其中多项为 JSON 字符串，调用方需要自行解析。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "sites",
        ":site_id"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [],
      "variable": [
        {
          "disabled": false,
          "description": {
            "content": "(Required) 要查询的网站 ID，必须是当前用户的网站；管理员可查询任意已有网站。",
            "type": "text/plain"
          },
          "type": "any",
          "value": "",
          "key": "site_id"
        }
      ]
    },
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "GET",
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}