InquiryPriceCreateInstance
1. 接口描述
调用本接口用于创建一个实例询价。
2. 请求参数
以下请求参数列表仅列出了接口中需要的请求参数
zoneId
是
String
实例所属的可用区ID。
instanceTypeId
是
String
实例机型ID。
具体取值可通过调用接口DescribeInstanceTypes
来获得最新的规格表。
instanceChargeType
是
String
实例计费类型。
PREPAID:预付费,即包年包月。 POSTPAID:后付费。
trafficPackageSize
否
Float
流量包订购大小。
单位为TB。该值仅限当 internetChargeType
= ByTrafficPackage
生效。
internetMaxBandwidthOut
否
Integer
公网出带宽上限。
单位:Mbps。
默认值:1Mbps。
不同机型带宽上限范围不一致,具体限制详见购买网络带宽。
3. 响应结果
4. 代码示例
1. 查询创建预付费实例的询价,带宽计费为固定带宽。
POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: InquiryPriceCreateInstance
<Common Request Params>
Request:
{
"zoneId": "SEL-A",
"instanceTypeId": "M6C",
"instanceChargeType": "PREPAID",
"instanceChargePrepaid": {
"period": 1
},
"trafficPackageSize": 100,
"internetMaxBandwidthOut": 200,
"internetChargeType": "ByBandwidth"
}
Response:
{
"requestId": "T01F25348-DA67-4726-97C1-538BAE714F8B",
"response": {
"requestId": "T01F25348-DA67-4726-97C1-538BAE714F8B",
"instancePrice": {
"discount": 95.0,
"discountPrice": 426.55,
"originalPrice": 449.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
"bandwidthPrice": [
{
"discount": 95.0,
"discountPrice": 1444.0,
"originalPrice": 1520.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
}
]
}
}
2. 查询创建后付费实例的询价,带宽计费为固定带宽。
POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: InquiryPriceCreateInstance
<Common Request Params>
Request:
{
"zoneId": "SEL-A",
"instanceTypeId": "M6C",
"instanceChargeType": "POSTPAID",
"trafficPackageSize": 100,
"internetMaxBandwidthOut": 200,
"internetChargeType": "ByBandwidth"
}
Response:
{
"requestId": "T3105EE4C-30C5-4FF2-9A34-688C8455376D",
"response": {
"requestId": "T3105EE4C-30C5-4FF2-9A34-688C8455376D",
"instancePrice": {
"discount": 100.0,
"discountPrice": null,
"originalPrice": null,
"unitPrice": 0.63,
"discountUnitPrice": 0.63,
"chargeUnit": "HOUR",
"stepPrices": null
},
"bandwidthPrice": [
{
"discount": 100.0,
"discountPrice": null,
"originalPrice": null,
"unitPrice": 1.32,
"discountUnitPrice": 1.32,
"chargeUnit": "HOUR",
"stepPrices": null
}
]
}
}
3. 查询创建预付费实例的询价,带宽计费为流量包。
POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: InquiryPriceCreateInstance
<Common Request Params>
Request:
{
"zoneId": "SEL-A",
"instanceTypeId": "M6C",
"instanceChargeType": "PREPAID",
"instanceChargePrepaid": {
"period": 1
},
"trafficPackageSize": 100,
"internetMaxBandwidthOut": 200,
"internetChargeType": "ByTrafficPackage"
}
Response:
{
"requestId": "T8CF9A34A-ECA2-4192-8515-CAC51C40592B",
"response": {
"requestId": "T8CF9A34A-ECA2-4192-8515-CAC51C40592B",
"instancePrice": {
"discount": 95.0,
"discountPrice": 426.55,
"originalPrice": 449.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
"bandwidthPrice": [
{
"discount": 95.0,
"discountPrice": 7524.0,
"originalPrice": 7920.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
{
"discount": 100.0,
"discountPrice": null,
"originalPrice": null,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": [
{
"stepStart": 0.0,
"stepEnd": null,
"unitPrice": 0.08,
"discountUnitPrice": 0.08
}
]
}
]
}
}
5. 开发者工具
Zenlayer Cloud API 2.0 提供了配套的开发工具集(SDK),未来会陆续支持更多开发语言,方便快速接入和使用Zenlayer的产品和服务。
6. 错误码
下面包含业务逻辑中遇到的错误码,其他错误码见公共错误码
404
INVALID_ZONE_NOT_FOUND
指定的可用区不存在。
404
INVALID_INSTANCE_TYPE_NOT_FOUND
未找到指定的实例规格。
400
INVALID_INSTANCE_TYPE_ZONE_NO_SELL
指定实例规格在指定的 可用区未售卖
400
INVALID_INSTANCE_BANDWIDTH_ZONE_NO_SELL
指定的公网计费类型在所选的可用区不支持
403
INVALID_CHARGE_TYPE_NOT_SUPPORT
付费类型不支持,请联系Support进行开通。
最后更新于