InquiryPriceCreateInstance

1. 接口描述

调用本接口用于创建一个实例询价。

2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

参数名称必选类型描述

zoneId

String

实例所属的可用区ID。

instanceTypeId

String

实例机型ID。 具体取值可通过调用接口DescribeInstanceTypes来获得最新的规格表。

instanceChargeType

String

实例计费类型。

PREPAID:预付费,即包年包月。 POSTPAID:后付费。

internetChargeType

String

网络计费类型。

取值范围请看InternetChargeType

instanceChargePrepaid

预付费模式,即包年包月相关参数设置。

通过该参数可以指定包年包月实例的购买时长等属性。

若指定实例的付费模式为预付费则该参数必传。

trafficPackageSize

Float

流量包订购大小。

单位为TB。该值仅限当 internetChargeType = ByTrafficPackage 生效。

internetMaxBandwidthOut

Integer

公网出带宽上限。

单位:Mbps。

默认值:1Mbps。

不同机型带宽上限范围不一致,具体限制详见购买网络带宽。

3. 响应结果

参数名称类型描述

instancePrice

实例价格。

bandwidthPrice

Array of Price

公网带宽价格。 可能有多个价格,比如流量包计费,包含包的价格和用量超出包后的价格

requestId

String

唯一请求 ID。

每次请求都会返回。定位问题时需要提供该次请求的 requestId。

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. 错误码

下面包含业务逻辑中遇到的错误码,其他错误码见公共错误码

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

指定的公网计费类型在所选的可用区不支持

403

INVALID_CHARGE_TYPE_NOT_SUPPORT

付费类型不支持,请联系Support进行开通。

最后更新于