询价接口
更新时间:2026-07-23
接口总览
| 接口名称 | 说明 | openapi 方法 | openapi 路径 |
|---|---|---|---|
| QueryCreateClusterPrice | 新建集群询价 | POST | /v2/bcc/order/price |
| QueryResizePrice | 变配询价 | POST | /v2/bcc/order/resizePrice |
QueryCreateClusterPrice
接口描述
新建集群询价,根据实例组配置计算集群创建费用。
请求结构
Plain Text
1POST /v2/bcc/order/price HTTP/1.1
2Content-Type: application/json
3
4{
5 "clusterId": clusterId,
6 "payType": payType,
7 "instanceGroups": [
8 {
9 "instanceType": instanceType,
10 "instanceCount": instanceCount,
11 "rootDiskSizeInGB": rootDiskSizeInGB,
12 "rootDiskMediumType": rootDiskMediumType,
13 "cds": [
14 {
15 "sizeInGB": sizeInGB,
16 "mediumType": mediumType
17 }
18 ]
19 }
20 ],
21 "purchaseLength": purchaseLength,
22}
请求参数
| 名称 | 类型 | 是否必须 | 参数位置 | 参数描述 |
|---|---|---|---|---|
| clusterId | String | 否 | RequestBody | 集群 ID(混合付费类型时使用) |
| payType | String | 是 | RequestBody | 付费类型(prepay: 预付费,postpay: 后付费),默认为后付费 |
| instanceGroups | List |
是 | RequestBody | 实例组配置列表 |
| purchaseLength | Int | 否 | RequestBody | 购买时长(月),预付费时必填 |
响应参数
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| success | Boolean | 请求是否成功 |
| status | Int | HTTP 状态码 |
| result | Price | 询价结果 |
请求示例
JSON
1{
2 "payType": "prepay",
3 "instanceGroups": [
4 {
5 "type": "Master",
6 "instanceType": "bmr.g4.c8m32",
7 "instanceCount": 3,
8 "rootDiskSizeInGB": 40,
9 "rootDiskMediumType": "ssd",
10 "cds": [
11 {
12 "sizeInGB": 100,
13 "mediumType": "ssd"
14 }
15 ]
16 },
17 {
18 "type": "Core",
19 "instanceType": "bmr.g4.c8m32",
20 "instanceCount": 3,
21 "rootDiskSizeInGB": 100,
22 "rootDiskMediumType": "ssd",
23 "cds": [
24 {
25 "sizeInGB": 500,
26 "mediumType": "ssd"
27 }
28 ]
29 }
30 ],
31 "purchaseLength": 1
32}
响应示例
JSON
1{
2 "success": true,
3 "status": 200,
4 "result": {
5 "price": 1234.56,
6 "dayCount": 0,
7 "discount": 0
8 }
9}
QueryResizePrice
接口描述
扩容询价,根据集群计费方式和实例组配置计算集群变配之后的费用。
请求结构
Plain Text
1POST /v2/bcc/order/resizeprice HTTP/1.1
2Content-Type: application/json
3
4{
5 "clusterId": clusterId,
6 "instanceGroups": [
7 {
8 "instanceType": instanceType,
9 "instanceCount": instanceCount,
10 "rootDiskSizeInGB": rootDiskSizeInGB,
11 "rootDiskMediumType": rootDiskMediumType,
12 "cds": [
13 {
14 "sizeInGB": sizeInGB,
15 "mediumType": mediumType
16 }
17 ]
18 }
19 ]
20}
请求参数
| 名称 | 类型 | 是否必须 | 参数位置 | 参数描述 |
|---|---|---|---|---|
| clusterId | String | 是 | RequestBody | 集群 ID |
| instanceGroups | List |
是 | RequestBody | 实例组配置列表 |
响应参数
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| success | Boolean | 请求是否成功 |
| status | Int | HTTP 状态码 |
| result | Price | 询价结果 |
请求示例
JSON
1{
2 "clusterId": "0181b994-576a-4a00-b04e-f6fa9d5eee48",
3 "instanceGroups": [
4 {
5 "instanceType": "bcc.g4.c8m32",
6 "instanceCount": 3,
7 "rootDiskSizeInGB": 100,
8 "rootDiskMediumType": "ssd",
9 "cds": [
10 {
11 "sizeInGB": 500,
12 "mediumType": "ssd"
13 }
14 ]
15 },
16 {
17 "instanceType": "bcc.g4.c8m32",
18 "instanceCount": 3,
19 "rootDiskSizeInGB": 100,
20 "rootDiskMediumType": "ssd",
21 "cds": [
22 {
23 "sizeInGB": 500,
24 "mediumType": "ssd"
25 }
26 ]
27 }
28 ]
29}
响应示例
JSON
1{
2 "success": true,
3 "status": 200,
4 "result": {
5 "price": 567.89,
6 "dayCount": 0,
7 "discount": 0
8 }
9}
错误返回码
| HTTP Status | Code | Message | 触发场景 | 适用接口 |
|---|---|---|---|---|
| 404 | ClusterNotFound | The cluster not found | clusterId 在当前租户下不存在 | GetResizePrice |
| 500 | InternalError | Internal server error | 内部服务调用失败(计价服务不可用等) | GetOldFlavorPrice, GetResizePrice |
评价此篇文章
