InquiryPriceCreateInstance
1. 接口描述
调用本接口用于创建一台虚拟机实例询价。
2. 请求参数
以下请求参数列表仅列出了接口中需要的请求参数
参数名称
必选
类型
描述
zoneId
是
String
实例所属的可用区ID。
trafficPackageSize
否
BigDecimal
流量包订购大小。
单位为TB。该值仅限当 internetChargeType
= ByTrafficPackage
生效且必填。
bandwidth
否
Integer
公网出带宽上限。
单位:Mbps。
不同机型带宽上限范围不一致,具体限制详见购买网络带宽。
instanceCount
否
Integer
数量,默认为1。
3. 响应结果
4. 代码示例
1. 查询实例的询价,带宽计费为固定带宽。
POST /api/v2/vm HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: InquiryPriceCreateInstance
<Common Request Params>
Request:
{
"zoneId":"SAO-A",
"instanceType":"c.1c2g",
"eipV4Type": "xxx",
"internetChargeType":"ByBandwidth",
"bandwidth":1,
"instanceCount": 1,
"systemDisk":{
"diskSize":10
}
}
Response:
{
"requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
"response":{
"requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
"specPrice": {
"discount": 95.0,
"discountPrice": 1444.0,
"originalPrice": 1520.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
"gpuPrice": {
"discount": 95.0,
"discountPrice": 1444.0,
"originalPrice": 1520.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
"ipv4Price": {
"discount": 95.0,
"discountPrice": 1444.0,
"originalPrice": 1520.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
"ipv6Price": {
"discount": 95.0,
"discountPrice": 1444.0,
"originalPrice": 1520.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
"ipv4BandwidthPrice": {
"discount": 95.0,
"discountPrice": 1444.0,
"originalPrice": 1520.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
"ipv6BandwidthPrice": {
"discount": 95.0,
"discountPrice": 1444.0,
"originalPrice": 1520.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
"systemDiskPrice": {
"discount": 95.0,
"discountPrice": 1444.0,
"originalPrice": 1520.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
},
"dataDiskPrice": {
"discount": 95.0,
"discountPrice": 1444.0,
"originalPrice": 1520.0,
"unitPrice": null,
"discountUnitPrice": null,
"chargeUnit": null,
"stepPrices": null
}
}
}
5. 开发者工具
Zenlayer Cloud API 2.0 提供了配套的开发工具集(SDK),未来会陆续支持更多开发语言,方便快速接入和使用Zenlayer的产品和服务。
6. 错误码
下面包含业务逻辑中遇到的错误码,其他错误码见公共错误码
HTTP状态码
错误码
说明
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
指定的公网计费类型在所选的可用区不支持
400
INVALID_PARAMETER_TRAFFIC_PACKAGE
流量包大小参数不合法 。
400
INVALID_PARAMETER_TRAFFIC_PACKAGE_EXCEED
流量包大小超过了最大限制
最后更新于