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

查询四层转发组列表

GET/v1/stream-groups

分页查询四层转发组。普通用户只能看到自己的转发组;管理员可使用 uid 仅查看指定用户的转发组。结果按组 ID 倒序返回。

身份认证

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",
  "schema": {
    "type": "integer",
    "minimum": 1,
    "default": 1,
    "example": 1
  },
  "description": "页码,必须为数字;未传时为 1。"
}
limitqueryinteger可选

每页返回数量,必须为数字;未传时为 10,传 0 表示不分页并返回全部。

完整参数定义
{
  "name": "limit",
  "in": "query",
  "schema": {
    "type": "integer",
    "minimum": 0,
    "default": 10,
    "example": 10
  },
  "description": "每页返回数量,必须为数字;未传时为 10,传 0 表示不分页并返回全部。"
}
uidqueryinteger可选

管理员可选。仅返回该用户的转发组;普通用户传入此参数不会改变其只能查看自己的范围。

完整参数定义
{
  "name": "uid",
  "in": "query",
  "required": false,
  "schema": {
    "type": "integer",
    "minimum": 1,
    "example": 12
  },
  "description": "管理员可选。仅返回该用户的转发组;普通用户传入此参数不会改变其只能查看自己的范围。"
}

响应

HTTP 200

请求已被处理。成功时返回列表与总数;页码或每页数量不是数字时仍返回 HTTP 200,并在 code 和 msg 中给出业务错误。

application/json

object

字段类型必填说明与约束
codeinteger必填

业务状态码;成功为 0。

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

符合筛选条件的转发组总数,不受分页限制影响。

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

四层转发组列表,按 ID 倒序。

展开字段结构

四层转发组列表,按 ID 倒序。

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

转发组 ID。

uidinteger必填

归属用户 ID。

namestring必填

转发组名称。

desstring必填

转发组备注。

usernamestring可选

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

约束 / 默认值 / 示例
{
  "nullable": true
}
完整 Schema
{
  "type": "object",
  "required": [
    "code",
    "count",
    "data"
  ],
  "properties": {
    "code": {
      "type": "integer",
      "description": "业务状态码;成功为 0。",
      "example": 0
    },
    "count": {
      "type": "integer",
      "minimum": 0,
      "description": "符合筛选条件的转发组总数,不受分页限制影响。",
      "example": 2
    },
    "data": {
      "type": "array",
      "description": "四层转发组列表,按 ID 倒序。",
      "items": {
        "type": "object",
        "required": [
          "id",
          "uid",
          "name",
          "des"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "description": "转发组 ID。"
          },
          "uid": {
            "type": "integer",
            "description": "归属用户 ID。"
          },
          "name": {
            "type": "string",
            "description": "转发组名称。"
          },
          "des": {
            "type": "string",
            "description": "转发组备注。"
          },
          "username": {
            "type": "string",
            "nullable": true,
            "description": "归属用户名,由用户表关联得到。"
          }
        }
      }
    }
  }
}

示例

{
  "code": 0,
  "count": 1,
  "data": [
    {
      "id": 3,
      "uid": 12,
      "name": "生产转发",
      "des": "TCP 服务",
      "username": "demo"
    }
  ]
}

查询成功

{
  "code": 0,
  "count": 1,
  "data": [
    {
      "id": 3,
      "uid": 12,
      "name": "生产转发",
      "des": "TCP 服务",
      "username": "demo"
    }
  ]
}

页码格式错误

{
  "code": "stream_group-4",
  "msg": "page参数格式不正确",
  "data": ""
}

cURL 示例

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

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

查看完整接口 JSON