tencent cloud

Feedback

DescribeDBPrice

Last updated: 2024-11-20 11:13:08

    1. API Description

    Domain name for API request: cdb.intl.tencentcloudapi.com.

    This API is used to query the purchase or renewal price of a pay-as-you-go or monthly subscribed TencentDB instance by passing in information such as instance type, purchase duration, number of instances to purchase, memory size, disk size, and AZ. For the price of instance renewal, you can pass in instance name to query.

    Note: To query prices in a specific region, you need to use the access point of the region. For more information on access points, see Service Address. For example, to query prices in Guangzhou, send a request to: cdb.ap-guangzhou.tencentcloudapi.com. Likewise, to query prices in Shanghai, send a request to: cdb.ap-shanghai.tencentcloudapi.com.

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: DescribeDBPrice.
    Version Yes String Common Params. The value used for this API: 2017-03-20.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    Period Yes Integer Instance validity period in months. Value range: 1-36. This field is invalid when querying the prices of pay-as-you-go instances.
    Zone No String AZ information in the format of "ap-guangzhou-2". You can use the DescribeDBZoneConfig API to query the configurable values. This parameter is required when InstanceId is empty.
    GoodsNum No Integer Number of instances. Value range: 1-100. Default value: 1. This parameter is required when InstanceId is empty.
    Memory No Integer Instance memory size in MB. This parameter is required when InstanceId is empty.
    Volume No Integer Instance disk size in GB. This parameter is required when InstanceId is empty.
    InstanceRole No String Instance type. Valid values: master (source instance), dr (disaster recovery instance), ro (read-only instance). Default value: master. This parameter is required when InstanceId is empty.
    PayType No String Billing mode. Valid values: PRE_PAID (monthly subscribed), HOUR_PAID (pay-as-you-go). This parameter is required when InstanceId is empty.
    ProtectMode No Integer Data replication mode. Valid values: 0 (async), 1 (semi-sync), 2 (strong sync). Default value: 0.
    DeviceType No String Instance isolation types Valid values: UNIVERSAL (general instance), EXCLUSIVE (dedicated instance), BASIC (basic instance). Default value: UNIVERSAL. Default value: UNIVERSAL.
    InstanceNodes No Integer The number of the instance. Valid values: 1 (for read-only and basic instances), 2 (for other source instances). To query the price of a three-node instance, set this value to 3.
    Cpu No Integer CPU core count of the price-queried instance. To ensure that the CPU value to be passed in is valid, use the DescribeDBZoneConfig API to query the number of purchasable cores. If this value is not specified, a default value based on memory size will be set.
    InstanceId No String Instance ID for querying renewal price. To query the renewal price of the instance, pass in the values of InstanceId and Period.
    Ladder No Integer Tiered pay-as-you-go pricing, which is valid only when PayType is set to HOUR_PAID. Valid values: 1, 2, 3. For more information on tiered duration, visit https://www.tencentcloud.com/document/product/236/18335.?from_cn_redirect=1

    3. Output Parameters

    Parameter Name Type Description
    Price Integer Instance price. If Currency is set to CNY, the unit will be 0.01 CNY. If Currency is set to USD, the unit will be US Cent.
    OriginalPrice Integer Original price of the instance. If Currency is set to CNY, the unit will be 0.01 CNY. If Currency is set to USD, the unit will be US Cent.
    Currency String Currency: CNY, USD.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Querying the purchase price of a TencentDB instance.

    This example shows you how to query the purchase price of an instance.

    Input Example

    POST / HTTP/1.1Host: cdb.intl.tencentcloudapi.comContent-Type: application/jsonX-TC-Action: DescribeDBPrice<common request parameters>{    "Zone": "ap-guangzhou-1",    "GoodsNum": "1",    "PayType": "PRE_PAID",    "Period": "24",    "Volume": "25",    "Memory": "1000);
    

    Output Example

    {
        "Response": {
            "RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7",
            "Currency": "USD",
            "Price": 48000,
            "OriginalPrice": 460800
        }
    }
    

    Example2 Querying the renewal price of a TencentDB instance

    This example shows you how to query the renewal price of a TencentDB instance.

    Input Example

    POST / HTTP/1.1Host: cdb.intl.tencentcloudapi.comContent-Type: application/jsonX-TC-Action: DescribeDBPrice<common request parameters>{    "InstanceId": "cdb-6no119yd",    "Period": "24"}
    

    Output Example

    {
        "Response": {
            "RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7",
            "Currency": "SD",
            "Price": 48000,
            "OriginalPrice": 460800
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

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

    Error Code Description
    InternalError.CauthError Authentication failed.
    InternalError.DatabaseAccessError Internal database error.
    InternalError.TradeError Transaction system error.
    InternalError.UndefinedError Unknown error
    InvalidParameter Parameter error.
    InvalidParameter.InstanceNotFound The instance does not exist.