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

更新四层转发组

PUT/v1/stream-groups/{group_id}

更新指定四层转发组的名称或备注。路径中的 group_id 会写入请求对象,客户端传入的 id 无法改变更新目标。请求体必须是 JSON 对象;普通用户仅能更新自己的转发组,管理员可更新其他用户的组。

身份认证

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

请求参数

参数位置类型必填说明与约束
group_idpathinteger必填

要更新的转发组 ID;必须存在且当前用户有操作权限。

完整参数定义
{
  "name": "group_id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "integer",
    "minimum": 1,
    "example": 3
  },
  "description": "要更新的转发组 ID;必须存在且当前用户有操作权限。"
}

请求体 · 必填

application/json

object

字段类型必填说明与约束
namestring可选

新的转发组名称;会进行 XSS 过滤,且同一归属用户下必须唯一。未传则保持原名称。

约束 / 默认值 / 示例
{
  "minLength": 1,
  "example": "生产转发"
}
desstring可选

新的备注;会进行 XSS 过滤,可传空字符串清空备注。未传则保持原备注。

约束 / 默认值 / 示例
{
  "example": "迁移后的 TCP 服务"
}
uidinteger可选

管理员专用。用于指定当前操作用户;更新已有组时不会改变组的归属用户。

约束 / 默认值 / 示例
{
  "minimum": 1,
  "example": 12
}
完整 Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "description": "新的转发组名称;会进行 XSS 过滤,且同一归属用户下必须唯一。未传则保持原名称。",
      "example": "生产转发"
    },
    "des": {
      "type": "string",
      "description": "新的备注;会进行 XSS 过滤,可传空字符串清空备注。未传则保持原备注。",
      "example": "迁移后的 TCP 服务"
    },
    "uid": {
      "type": "integer",
      "minimum": 1,
      "description": "管理员专用。用于指定当前操作用户;更新已有组时不会改变组的归属用户。",
      "example": 12
    }
  },
  "example": {
    "name": "生产转发",
    "des": "迁移后的 TCP 服务"
  }
}

请求体示例

{
  "name": "生产转发",
  "des": "迁移后的 TCP 服务"
}

响应

HTTP 200

请求已被处理。成功时 code 为 0、msg 为“更新转发组成功”、data 为 null;组不存在、无权限、名称为空或重名时仍返回 HTTP 200。

application/json

object

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

业务状态码;成功为 0。

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

处理结果说明。

约束 / 默认值 / 示例
{
  "example": "更新转发组成功"
}
datastring必填

成功时为 null;失败时为空字符串。

约束 / 默认值 / 示例
{
  "nullable": true,
  "example": null
}
完整 Schema
{
  "type": "object",
  "required": [
    "code",
    "msg",
    "data"
  ],
  "properties": {
    "code": {
      "type": "integer",
      "description": "业务状态码;成功为 0。",
      "example": 0
    },
    "msg": {
      "type": "string",
      "description": "处理结果说明。",
      "example": "更新转发组成功"
    },
    "data": {
      "type": "string",
      "nullable": true,
      "description": "成功时为 null;失败时为空字符串。",
      "example": null
    }
  }
}

示例

{
  "code": 0,
  "msg": "更新转发组成功",
  "data": null
}

更新备注

{
  "code": 0,
  "msg": "更新转发组成功",
  "data": null
}

组不存在

{
  "code": "stream_group-6",
  "msg": "group id不存在",
  "data": ""
}

cURL 示例

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

curl --request PUT \
  "https://master.example.invalid/v1/stream-groups/{group_id}" \
  --header "access-token: YOUR_ACCESS_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{"name": "生产转发", "des": "迁移后的 TCP 服务"}'

查看完整接口 JSON