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

查询网站组列表

GET/v1/site-groups

分页查询网站组,按网站组 ID 倒序返回。普通用户仅查询自己的网站组;管理员可查询全部,或通过 uid 查询指定用户的网站组。

身份认证

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

请求参数

参数位置类型必填说明与约束
pagequeryinteger可选

页码,必须为数字;默认 1。

完整参数定义
{
  "name": "page",
  "in": "query",
  "required": false,
  "schema": {
    "type": "integer",
    "minimum": 1,
    "default": 1,
    "example": 1
  },
  "description": "页码,必须为数字;默认 1。"
}
limitqueryinteger可选

每页条数,必须为数字;默认 10。传 0 时不分页。

完整参数定义
{
  "name": "limit",
  "in": "query",
  "required": false,
  "schema": {
    "type": "integer",
    "minimum": 0,
    "default": 10,
    "example": 10
  },
  "description": "每页条数,必须为数字;默认 10。传 0 时不分页。"
}
uidqueryinteger可选

仅管理员有效:按网站组所属用户 ID 精确筛选。普通用户传入后仍只返回自己的记录。

完整参数定义
{
  "name": "uid",
  "in": "query",
  "required": false,
  "schema": {
    "type": "integer",
    "minimum": 1,
    "example": 12
  },
  "description": "仅管理员有效:按网站组所属用户 ID 精确筛选。普通用户传入后仍只返回自己的记录。"
}

响应

HTTP 200

查询成功时不含 msg 字段;参数或认证错误仍返回 HTTP 200。

application/json

oneOf

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

业务状态码;0 表示成功。

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

筛选后的网站组总数,未受分页影响。

约束 / 默认值 / 示例
{
  "minimum": 0,
  "example": 1
}
dataarray <object>必填

当前页网站组记录。

展开字段结构

当前页网站组记录。

数组元素 · object
字段类型必填说明与约束
idinteger必填

网站组 ID。

uidinteger必填

网站组所属用户 ID。

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

网站组名称。

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

网站组备注。

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

所属用户的用户名,由用户表关联得到。

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

页码/分页条数格式错误或未登录时的业务错误码。

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

错误原因。

约束 / 默认值 / 示例
{
  "example": "page参数格式不正确"
}
datastring必填

错误响应中的固定空字符串。

约束 / 默认值 / 示例
{
  "example": ""
}
完整 Schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "code",
        "count",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "enum": [
            0
          ],
          "description": "业务状态码;0 表示成功。"
        },
        "count": {
          "type": "integer",
          "minimum": 0,
          "description": "筛选后的网站组总数,未受分页影响。",
          "example": 1
        },
        "data": {
          "type": "array",
          "description": "当前页网站组记录。",
          "items": {
            "type": "object",
            "required": [
              "id",
              "uid",
              "name",
              "des",
              "username"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "description": "网站组 ID。"
              },
              "uid": {
                "type": "integer",
                "nullable": true,
                "description": "网站组所属用户 ID。"
              },
              "name": {
                "type": "string",
                "nullable": true,
                "description": "网站组名称。"
              },
              "des": {
                "type": "string",
                "nullable": true,
                "description": "网站组备注。"
              },
              "username": {
                "type": "string",
                "nullable": true,
                "description": "所属用户的用户名,由用户表关联得到。"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "site_group-4",
            "site_group-5",
            "login_required"
          ],
          "description": "页码/分页条数格式错误或未登录时的业务错误码。"
        },
        "msg": {
          "type": "string",
          "description": "错误原因。",
          "example": "page参数格式不正确"
        },
        "data": {
          "type": "string",
          "description": "错误响应中的固定空字符串。",
          "example": ""
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "count": 1,
  "data": [
    {
      "id": 21,
      "uid": 12,
      "name": "生产网站",
      "des": "主要业务站点",
      "username": "demo-user"
    }
  ]
}

查询成功

{
  "code": 0,
  "count": 1,
  "data": [
    {
      "id": 21,
      "uid": 12,
      "name": "生产网站",
      "des": "主要业务站点",
      "username": "demo-user"
    }
  ]
}

cURL 示例

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

curl --request GET \
  "https://master.example.invalid/v1/site-groups" \
  --header "access-token: YOUR_ACCESS_TOKEN"

查看完整接口 JSON