InquiryPriceCreateInstance

1. API Description

This API is used to query the price of creating a virtual machine instance.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

zoneId

Yes

String

ID of zone to which the instance belongs.

instanceType

Yes

String

Instance model. To view specific values, you can call DescribeZoneInstanceConfigInfos.

instanceChargeType

Yes

String

Instance pricing model. PREPAID: subscription

POSTPAID: pay-as-you-go.

internetChargeType

Yes

String

Network pricing model.

See InternetChargeType for details.

instanceChargePrepaid

No

Details of the monthly subscription, including the purchase period, auto-renewal. It is required if the instanceChargeType is PREPAID.

trafficPackageSize

No

Float

Traffic package size (TB).

The parameter is valid only when internetChargeType is ByTrafficPackage.

internetMaxBandwidthOut

No

Integer

Public network bandwidth cap (Mbps).

Default value: 1 Mbps.

The parameter value differs by different instance models. See bandwidth configuration for details.

systemDisk

Yes

System disk.

dataDisks

No

Array of DataDisk

Data disk.

3. Output Parameters

Parameter Name
Type
Description

instancePrice

Instance price.

bandwidthPrice

Array of Price

Price of public bandwidth. Kinds of prices may exist. For example, traffic package billing method may contain the package price and overage price.

systemDiskPrice

System disk price.

dataDiskPrice

Price of data disks. When query prices of data disks with different specifications, only discountPrice and originalPrice are valid.

dataDiskPrices

Array of DataDisk

Prices of data disks with different specifications This parameter corresponds to the dataDisks in the input parameter. The similar values will be merged based on size and category.

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Code Example

Query the price of a subscription instance with the public network billing method of flat rate.

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",
    "imageId":"img-yKK4q6XybymPgfx7ynUUqC3N8",
    "instanceChargeType":"PREPAID",
    "internetChargeType":"ByBandwidth",
    "instanceChargePrepaid":{
        "period":1
    },
    "internetMaxBandwidthOut":1,
    "systemDisk":{
        "diskSize":10
    }
}

Response:
{
    "requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
    "response":{
        "requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
        "instancePrice":{
            "discount":95,
            "discountPrice":13.3,
            "originalPrice":14
        },
        "bandwidthPrice":[
            {
                "discount":95,
                "discountPrice":3.8,
                "originalPrice":4
            }
        ],
        "systemDiskPrice":{
            "discount":96,
            "discountPrice":0.48,
            "originalPrice":0.5
        }
    }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.​

HTTP Status Code
Error Code
Description

404

INVALID_ZONE_NOT_FOUND

Zone not found.

404

INVALID_INSTANCE_TYPE_NOT_FOUND

Instance model not found.

400

INVALID_INSTANCE_TYPE_ZONE_NO_SELL

Instance model not available in the zone.

400

INVALID_INSTANCE_BANDWIDTH_ZONE_NO_SELL

Public network pricing model not supported in zhe zone.

400

INVALID_PARAMETER_TRAFFIC_PACKAGE

Invalid data transfer package size.

400

INVALID_PARAMETER_TRAFFIC_PACKAGE_EXCEED

Data transfer package size exceeds the upper limit.

Last updated