获取套餐详情
/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_id | path | integer | 必填 | 套餐 ID。 完整参数定义 |
duration | query | string | 可选 | 购买周期。传入后触发当前用户的价格试算。 完整参数定义 |
coupon_code | query | string | 可选 | 优惠码;仅在传入 完整参数定义 |
响应
HTTP 200
成功、未登录、套餐不存在、普通用户查询停用套餐及周期参数非法均返回 HTTP 200。
application/json
oneOf
oneOf · 1 · object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 业务状态码;0 表示成功。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
msg | string | 必填 | 成功时为空字符串。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data | object | 必填 | 套餐记录;指定 约束 / 默认值 / 示例展开字段结构套餐记录;指定
|
oneOf · 2 · object
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
code | string | 必填 | 周期参数非法、套餐不存在、普通用户无权查询停用套餐或未登录时的业务错误码。 约束 / 默认值 / 示例 |
msg | string | 必填 | 错误原因。 约束 / 默认值 / 示例 |
data | string | 必填 | 错误响应中的固定空字符串。 约束 / 默认值 / 示例 |
完整 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"