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

获取套餐详情

GET/v1/packages/{package_id}

获取一条套餐记录。普通用户只能读取启用套餐,管理员可读取停用套餐。传入 duration 时,服务端会按当前登录用户的有效折扣和可用优惠码试算该周期价格,并在返回数据中附加价格字段。

身份认证

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

请求参数

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

套餐 ID。

完整参数定义
{
  "name": "package_id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "integer",
    "minimum": 1,
    "example": 11
  },
  "description": "套餐 ID。"
}
durationquerystring可选

购买周期。传入后触发当前用户的价格试算。

完整参数定义
{
  "name": "duration",
  "in": "query",
  "required": false,
  "description": "购买周期。传入后触发当前用户的价格试算。",
  "schema": {
    "type": "string",
    "enum": [
      "month",
      "quarter",
      "year"
    ],
    "example": "month"
  }
}
coupon_codequerystring可选

优惠码;仅在传入 duration 时用于价格试算。存在有效用户折扣时不会与优惠码叠加,原因通过响应中的 err 返回。

完整参数定义
{
  "name": "coupon_code",
  "in": "query",
  "required": false,
  "description": "优惠码;仅在传入 `duration` 时用于价格试算。存在有效用户折扣时不会与优惠码叠加,原因通过响应中的 `err` 返回。",
  "schema": {
    "type": "string",
    "example": "REDACTED_COUPON"
  }
}

响应

HTTP 200

成功、未登录、套餐不存在、普通用户查询停用套餐及周期参数非法均返回 HTTP 200。

application/json

oneOf

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

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

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

成功时为空字符串。

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

套餐记录;指定 duration 时会额外包含 orgin_price、new_price 和 err。

约束 / 默认值 / 示例
{
  "additionalProperties": false
}
展开字段结构

套餐记录;指定 duration 时会额外包含 orgin_price、new_price 和 err。

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

套餐 ID。

namestring可选

套餐名称。

约束 / 默认值 / 示例
{
  "nullable": true
}
desstring可选

套餐备注。

约束 / 默认值 / 示例
{
  "nullable": true
}
region_idinteger可选

所属区域 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
node_group_idinteger可选

主线路组 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
backup_node_groupinteger可选

备用线路组 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
cname_domaininteger可选

CNAME 域名配置 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
cname_hostname2string可选

备用 CNAME 主机名。

约束 / 默认值 / 示例
{
  "nullable": true
}
cname_modestring可选

CNAME 使用模式。

约束 / 默认值 / 示例
{
  "nullable": true
}
trafficinteger可选

流量额度;-1 表示不限。

约束 / 默认值 / 示例
{
  "nullable": true
}
bandwidthstring可选

带宽限制值;-1 表示不限。

约束 / 默认值 / 示例
{
  "nullable": true
}
connectioninteger可选

连接数限制;-1 表示不限。

约束 / 默认值 / 示例
{
  "nullable": true
}
domaininteger可选

域名数量限制;-1 表示不限。

约束 / 默认值 / 示例
{
  "nullable": true
}
main_domaininteger可选

主域名数量限制;-1 表示不限。

约束 / 默认值 / 示例
{
  "nullable": true
}
http_portinteger可选

HTTP 端口数量限制;-1 表示不限。

约束 / 默认值 / 示例
{
  "nullable": true
}
stream_portinteger可选

四层转发端口数量限制;-1 表示不限。

约束 / 默认值 / 示例
{
  "nullable": true
}
custom_cc_ruleinteger可选

是否允许自定义 CC 规则:1 为允许。

约束 / 默认值 / 示例
{
  "nullable": true,
  "enum": [
    0,
    1
  ]
}
websocketinteger可选

是否支持 WebSocket:1 为支持。

约束 / 默认值 / 示例
{
  "nullable": true,
  "enum": [
    0,
    1
  ]
}
http3integer可选

是否支持 HTTP/3:1 为支持。

约束 / 默认值 / 示例
{
  "nullable": true,
  "enum": [
    0,
    1
  ]
}
l2_stateinteger可选

是否启用二层调度能力:1 为启用。

约束 / 默认值 / 示例
{
  "nullable": true,
  "enum": [
    0,
    1
  ]
}
cc_protectstring可选

CC 防护能力说明。

约束 / 默认值 / 示例
{
  "nullable": true
}
ddos_protectstring可选

DDoS 防护能力说明。

约束 / 默认值 / 示例
{
  "nullable": true
}
expirestring可选

套餐截止时间,由数据库日期时间字段序列化返回。

约束 / 默认值 / 示例
{
  "nullable": true
}
buy_num_limitinteger可选

单用户购买数量限制;-1 表示不限。

约束 / 默认值 / 示例
{
  "nullable": true
}
backend_ip_limitstring可选

源站 IP/CIDR 限制配置文本。

约束 / 默认值 / 示例
{
  "nullable": true
}
id_verifyinteger可选

是否要求实名认证:1 为要求。

约束 / 默认值 / 示例
{
  "nullable": true,
  "enum": [
    0,
    1
  ]
}
before_exp_days_renewinteger可选

到期前允许续费的提前天数;-1 表示不限。

约束 / 默认值 / 示例
{
  "nullable": true
}
month_priceinteger可选

月付价格,单位为系统最小货币单位。

约束 / 默认值 / 示例
{
  "nullable": true
}
quarter_priceinteger可选

季付价格,单位为系统最小货币单位。

约束 / 默认值 / 示例
{
  "nullable": true
}
year_priceinteger可选

年付价格,单位为系统最小货币单位。

约束 / 默认值 / 示例
{
  "nullable": true
}
create_atstring可选

创建时间,由数据库日期时间字段序列化返回。

约束 / 默认值 / 示例
{
  "nullable": true
}
update_atstring可选

最后更新时间,由数据库日期时间字段序列化返回。

约束 / 默认值 / 示例
{
  "nullable": true
}
sortinteger可选

展示排序值。

约束 / 默认值 / 示例
{
  "nullable": true
}
ownerstring可选

专属用户 ID 列表,使用英文逗号分隔。

约束 / 默认值 / 示例
{
  "nullable": true
}
enableinteger可选

是否启用:1 为启用,0 为停用。

约束 / 默认值 / 示例
{
  "nullable": true,
  "enum": [
    0,
    1
  ]
}
orgin_priceinteger可选

仅传 duration 时返回:所选周期的原始价格,单位为系统最小货币单位。

new_priceinteger可选

仅传 duration 时返回:应用有效折扣或优惠码后的所选周期试算价格,单位为系统最小货币单位。

errstring可选

仅传 duration 时返回:优惠码或折扣不能应用时的原因;无错误时为 null。

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

周期参数非法、套餐不存在、普通用户无权查询停用套餐或未登录时的业务错误码。

约束 / 默认值 / 示例
{
  "enum": [
    "package-83",
    "package-36",
    "package-37",
    "login_required"
  ]
}
msgstring必填

错误原因。

约束 / 默认值 / 示例
{
  "example": "无权限查询"
}
datastring必填

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

约束 / 默认值 / 示例
{
  "example": ""
}
完整 Schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "enum": [
            0
          ],
          "description": "业务状态码;0 表示成功。"
        },
        "msg": {
          "type": "string",
          "description": "成功时为空字符串。",
          "example": ""
        },
        "data": {
          "type": "object",
          "description": "套餐记录;指定 `duration` 时会额外包含 `orgin_price`、`new_price` 和 `err`。",
          "properties": {
            "id": {
              "type": "integer",
              "description": "套餐 ID。"
            },
            "name": {
              "type": "string",
              "nullable": true,
              "description": "套餐名称。"
            },
            "des": {
              "type": "string",
              "nullable": true,
              "description": "套餐备注。"
            },
            "region_id": {
              "type": "integer",
              "nullable": true,
              "description": "所属区域 ID。"
            },
            "node_group_id": {
              "type": "integer",
              "nullable": true,
              "description": "主线路组 ID。"
            },
            "backup_node_group": {
              "type": "integer",
              "nullable": true,
              "description": "备用线路组 ID。"
            },
            "cname_domain": {
              "type": "integer",
              "nullable": true,
              "description": "CNAME 域名配置 ID。"
            },
            "cname_hostname2": {
              "type": "string",
              "nullable": true,
              "description": "备用 CNAME 主机名。"
            },
            "cname_mode": {
              "type": "string",
              "nullable": true,
              "description": "CNAME 使用模式。"
            },
            "traffic": {
              "type": "integer",
              "nullable": true,
              "description": "流量额度;`-1` 表示不限。"
            },
            "bandwidth": {
              "type": "string",
              "nullable": true,
              "description": "带宽限制值;`-1` 表示不限。"
            },
            "connection": {
              "type": "integer",
              "nullable": true,
              "description": "连接数限制;`-1` 表示不限。"
            },
            "domain": {
              "type": "integer",
              "nullable": true,
              "description": "域名数量限制;`-1` 表示不限。"
            },
            "main_domain": {
              "type": "integer",
              "nullable": true,
              "description": "主域名数量限制;`-1` 表示不限。"
            },
            "http_port": {
              "type": "integer",
              "nullable": true,
              "description": "HTTP 端口数量限制;`-1` 表示不限。"
            },
            "stream_port": {
              "type": "integer",
              "nullable": true,
              "description": "四层转发端口数量限制;`-1` 表示不限。"
            },
            "custom_cc_rule": {
              "type": "integer",
              "nullable": true,
              "enum": [
                0,
                1
              ],
              "description": "是否允许自定义 CC 规则:1 为允许。"
            },
            "websocket": {
              "type": "integer",
              "nullable": true,
              "enum": [
                0,
                1
              ],
              "description": "是否支持 WebSocket:1 为支持。"
            },
            "http3": {
              "type": "integer",
              "nullable": true,
              "enum": [
                0,
                1
              ],
              "description": "是否支持 HTTP/3:1 为支持。"
            },
            "l2_state": {
              "type": "integer",
              "nullable": true,
              "enum": [
                0,
                1
              ],
              "description": "是否启用二层调度能力:1 为启用。"
            },
            "cc_protect": {
              "type": "string",
              "nullable": true,
              "description": "CC 防护能力说明。"
            },
            "ddos_protect": {
              "type": "string",
              "nullable": true,
              "description": "DDoS 防护能力说明。"
            },
            "expire": {
              "type": "string",
              "nullable": true,
              "description": "套餐截止时间,由数据库日期时间字段序列化返回。"
            },
            "buy_num_limit": {
              "type": "integer",
              "nullable": true,
              "description": "单用户购买数量限制;`-1` 表示不限。"
            },
            "backend_ip_limit": {
              "type": "string",
              "nullable": true,
              "description": "源站 IP/CIDR 限制配置文本。"
            },
            "id_verify": {
              "type": "integer",
              "nullable": true,
              "enum": [
                0,
                1
              ],
              "description": "是否要求实名认证:1 为要求。"
            },
            "before_exp_days_renew": {
              "type": "integer",
              "nullable": true,
              "description": "到期前允许续费的提前天数;`-1` 表示不限。"
            },
            "month_price": {
              "type": "integer",
              "nullable": true,
              "description": "月付价格,单位为系统最小货币单位。"
            },
            "quarter_price": {
              "type": "integer",
              "nullable": true,
              "description": "季付价格,单位为系统最小货币单位。"
            },
            "year_price": {
              "type": "integer",
              "nullable": true,
              "description": "年付价格,单位为系统最小货币单位。"
            },
            "create_at": {
              "type": "string",
              "nullable": true,
              "description": "创建时间,由数据库日期时间字段序列化返回。"
            },
            "update_at": {
              "type": "string",
              "nullable": true,
              "description": "最后更新时间,由数据库日期时间字段序列化返回。"
            },
            "sort": {
              "type": "integer",
              "nullable": true,
              "description": "展示排序值。"
            },
            "owner": {
              "type": "string",
              "nullable": true,
              "description": "专属用户 ID 列表,使用英文逗号分隔。"
            },
            "enable": {
              "type": "integer",
              "nullable": true,
              "enum": [
                0,
                1
              ],
              "description": "是否启用:1 为启用,0 为停用。"
            },
            "orgin_price": {
              "type": "integer",
              "description": "仅传 `duration` 时返回:所选周期的原始价格,单位为系统最小货币单位。"
            },
            "new_price": {
              "type": "integer",
              "description": "仅传 `duration` 时返回:应用有效折扣或优惠码后的所选周期试算价格,单位为系统最小货币单位。"
            },
            "err": {
              "type": "string",
              "nullable": true,
              "description": "仅传 `duration` 时返回:优惠码或折扣不能应用时的原因;无错误时为 null。"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "package-83",
            "package-36",
            "package-37",
            "login_required"
          ],
          "description": "周期参数非法、套餐不存在、普通用户无权查询停用套餐或未登录时的业务错误码。"
        },
        "msg": {
          "type": "string",
          "description": "错误原因。",
          "example": "无权限查询"
        },
        "data": {
          "type": "string",
          "description": "错误响应中的固定空字符串。",
          "example": ""
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "msg": "",
  "data": {
    "id": 11,
    "name": "标准套餐",
    "region_id": 1,
    "node_group_id": 2,
    "cname_domain": 1,
    "traffic": 100,
    "bandwidth": "10Mbps",
    "connection": 1000,
    "domain": 10,
    "main_domain": 1,
    "http_port": 2,
    "stream_port": 0,
    "custom_cc_rule": 1,
    "websocket": 1,
    "http3": 1,
    "l2_state": 0,
    "month_price": 1000,
    "quarter_price": 2700,
    "year_price": 10000,
    "enable": 1,
    "orgin_price": 1000,
    "new_price": 900,
    "err": null
  }
}

携带周期的价格试算

{
  "code": 0,
  "msg": "",
  "data": {
    "id": 11,
    "name": "标准套餐",
    "region_id": 1,
    "node_group_id": 2,
    "cname_domain": 1,
    "traffic": 100,
    "bandwidth": "10Mbps",
    "connection": 1000,
    "domain": 10,
    "main_domain": 1,
    "http_port": 2,
    "stream_port": 0,
    "custom_cc_rule": 1,
    "websocket": 1,
    "http3": 1,
    "l2_state": 0,
    "month_price": 1000,
    "quarter_price": 2700,
    "year_price": 10000,
    "enable": 1,
    "orgin_price": 1000,
    "new_price": 900,
    "err": null
  }
}

cURL 示例

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

curl --request GET \
  "https://master.example.invalid/v1/packages/{package_id}" \
  --header "access-token: YOUR_ACCESS_TOKEN"

查看完整接口 JSON