tencent cloud

文档反馈

InquirePriceRenewInstances

最后更新时间:2023-12-04 16:31:53

    1. API Description

    Domain name for API request: lighthouse.tencentcloudapi.com.

    This API is used to query the price of renewing one or more instances.

    A maximum of 10 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: InquirePriceRenewInstances.
    Version Yes String Common Params. The value used for this API: 2020-03-24.
    Region No String Common Params. This parameter is not required for this API.
    InstanceIds.N Yes Array of String IDs of the instances to be renewed. Each request can contain up to 50 instances at a time. You can get an instance ID from the InstanceId returned by the DescribeInstances API.
    InstanceChargePrepaid Yes InstanceChargePrepaid Parameter setting for prepaid mode. This parameter can specify the renewal period, whether to enable auto-renewal, and other attributes of the monthly subscribed instances.
    RenewDataDisk No Boolean Whether to renew the data disk. Default: false.
    AlignInstanceExpiredTime No Boolean Whether to align the data disk expiration with the instance expiration time. Default: false.

    3. Output Parameters

    Parameter Name Type Description
    Price Price Price information. It defaults to the price information of the first instance in the list.
    DataDiskPriceSet Array of DataDiskPrice List of data disk price information.
    Note: This field may return null, indicating that no valid values can be obtained.
    InstancePriceDetailSet Array of InstancePriceDetail Price list of the instances to be renewed.
    Note: This field may return null, indicating that no valid value was found.
    TotalPrice TotalPrice Total price
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Querying the price of renewing instances (succeeded)

    This example shows you how to query the price of renewing instances.

    Input Example

    POST / HTTP/1.1
    Host: lighthouse.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: InquirePriceRenewInstances
    <Common request parameters>
    
    {
        "InstanceChargePrepaid": {
            "RenewFlag": "NOTIFY_AND_AUTO_RENEW",
            "Period": "1"
        },
        "InstanceIds": [
            "lhins-iqrj7783"
        ]
    }
    

    Output Example

    {
        "Response": {
            "Price": {
                "InstancePrice": {
                    "Currency": "USD",
                    "OriginalBundlePrice": 50,
                    "OriginalPrice": 50,
                    "Discount": 40,
                    "DiscountPrice": 20
                }
            },
            "DataDiskPriceSet": [],
            "InstancePriceDetailSet": [
                {
                    "InstanceId": "lhins-iqrj7783",
                    "InstancePrice": {
                        "Currency": "USD",
                        "OriginalBundlePrice": 50,
                        "OriginalPrice": 50,
                        "Discount": 40,
                        "DiscountPrice": 20
                    },
                    "DiscountDetail": [
                        {
                            "TimeSpan": 1,
                            "TimeUnit": "m",
                            "Discount": 40,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 100,
                                "ActivityDiscount": 40,
                                "FinalDiscount": 40,
                                "DiscountType": "activity"
                            },
                            "TotalCost": 50,
                            "RealTotalCost": 20
                        },
                        {
                            "TimeSpan": 2,
                            "TimeUnit": "m",
                            "Discount": 30,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 100,
                                "ActivityDiscount": 30,
                                "FinalDiscount": 30,
                                "DiscountType": "activity"
                            },
                            "TotalCost": 100,
                            "RealTotalCost": 30
                        },
                        {
                            "TimeSpan": 3,
                            "TimeUnit": "m",
                            "Discount": 25,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 100,
                                "ActivityDiscount": 25,
                                "FinalDiscount": 25,
                                "DiscountType": "activity"
                            },
                            "TotalCost": 150,
                            "RealTotalCost": 37.5
                        },
                        {
                            "TimeSpan": 4,
                            "TimeUnit": "m",
                            "Discount": 100,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 100,
                                "ActivityDiscount": null,
                                "FinalDiscount": 100,
                                "DiscountType": null
                            },
                            "TotalCost": 200,
                            "RealTotalCost": 200
                        },
                        {
                            "TimeSpan": 5,
                            "TimeUnit": "m",
                            "Discount": 100,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 100,
                                "ActivityDiscount": null,
                                "FinalDiscount": 100,
                                "DiscountType": null
                            },
                            "TotalCost": 250,
                            "RealTotalCost": 250
                        },
                        {
                            "TimeSpan": 6,
                            "TimeUnit": "m",
                            "Discount": 88,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 88,
                                "ActivityDiscount": 100,
                                "FinalDiscount": 88,
                                "DiscountType": "common"
                            },
                            "TotalCost": 300,
                            "RealTotalCost": 264
                        },
                        {
                            "TimeSpan": 7,
                            "TimeUnit": "m",
                            "Discount": 88,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 88,
                                "ActivityDiscount": 100,
                                "FinalDiscount": 88,
                                "DiscountType": "common"
                            },
                            "TotalCost": 350,
                            "RealTotalCost": 308
                        },
                        {
                            "TimeSpan": 8,
                            "TimeUnit": "m",
                            "Discount": 88,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 88,
                                "ActivityDiscount": 100,
                                "FinalDiscount": 88,
                                "DiscountType": "common"
                            },
                            "TotalCost": 400,
                            "RealTotalCost": 352
                        },
                        {
                            "TimeSpan": 9,
                            "TimeUnit": "m",
                            "Discount": 88,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 88,
                                "ActivityDiscount": 100,
                                "FinalDiscount": 88,
                                "DiscountType": "common"
                            },
                            "TotalCost": 450,
                            "RealTotalCost": 396
                        },
                        {
                            "TimeSpan": 10,
                            "TimeUnit": "m",
                            "Discount": 88,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 88,
                                "ActivityDiscount": 100,
                                "FinalDiscount": 88,
                                "DiscountType": "common"
                            },
                            "TotalCost": 500,
                            "RealTotalCost": 440
                        },
                        {
                            "TimeSpan": 11,
                            "TimeUnit": "m",
                            "Discount": 88,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 88,
                                "ActivityDiscount": 100,
                                "FinalDiscount": 88,
                                "DiscountType": "common"
                            },
                            "TotalCost": 550,
                            "RealTotalCost": 484
                        },
                        {
                            "TimeSpan": 12,
                            "TimeUnit": "m",
                            "Discount": 85,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 85,
                                "ActivityDiscount": 100,
                                "FinalDiscount": 85,
                                "DiscountType": "common"
                            },
                            "TotalCost": 600,
                            "RealTotalCost": 510
                        },
                        {
                            "TimeSpan": 24,
                            "TimeUnit": "m",
                            "Discount": 85,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 85,
                                "ActivityDiscount": 100,
                                "FinalDiscount": 85,
                                "DiscountType": "common"
                            },
                            "TotalCost": 1200,
                            "RealTotalCost": 1020
                        },
                        {
                            "TimeSpan": 36,
                            "TimeUnit": "m",
                            "Discount": 85,
                            "PolicyDetail": {
                                "UserDiscount": 100,
                                "CommonDiscount": 85,
                                "ActivityDiscount": 100,
                                "FinalDiscount": 85,
                                "DiscountType": "common"
                            },
                            "TotalCost": 1800,
                            "RealTotalCost": 1530
                        }
                    ]
                }
            ],
            "TotalPrice": {
                "OriginalPrice": 50,
                "DiscountPrice": 20
            },
            "RequestId": "22e25e9c-a1d2-4a82-aca0-6fd9e18f3df2"
        }
    }
    

    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
    FailedOperation Operation failed.
    FailedOperation.TradeGetPriceFailed Failed to query the price.
    InternalError.RequestError There was an error in the request.
    InternalError.TradeGetPriceFailed Failed to get the price.
    InvalidParameterValue.Duplicated Invalid parameter value: duplicate values are not allowed.
    InvalidParameterValue.InstanceIdMalformed Invalid parameter value: the instance ID format is invalid.
    InvalidParameterValue.LimitExceeded Invalid parametric value: the number of parameter values exceeds the upper limit.
    ResourceNotFound.InstanceDataDiskNotFound There are no data disks mounted to the instance.
    ResourceNotFound.InstanceIdNotFound The instance ID does not exist.
    UnauthorizedOperation.NoPermission No permission