Updated on 2024-08-27 GMT+08:00

Querying the Renewal Price of a Yearly/Monthly Resource

Function

Customers can query the renewal price of a yearly/monthly resource by criteria on a self-built platform.

  • If a primary resource has resources attached, the renewal price will include the price of the primary resource and that of the attached. The information of the attached resources can also be accessed through Querying Customer's Yearly/Monthly Resources.
  • Note: When a newly purchased EVS disk is attached to an ECS, the EVS disk is not necessarily an attached resource of the ECS. The precise information of the attached resources can only be accessed through Querying Customer's Yearly/Monthly Resources.

Constraints

Only customer AK/SK or Token can be used to call the API.

Debugging

You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug SDK code samples.

URI

POST /v2/bills/ratings/period-resources/renew-rate

Request

Request parameters

Parameter

Mandatory

Parameter Type

Value Range

Description

resource_ids

Yes

List<String>

[1-10]

Primary resource IDs

A maximum of 10 resource IDs are supported.

Determine whether a resource is a primary resource or not by the is_main_resource, a response parameter described in Querying Customer's Yearly/Monthly Resources.

period_type

Yes

Integer

[2|3]

Period type:

  • 2: Month
  • 3: Year

period_num

Yes

Integer

[1-11]

Number of periods:

  • Month: 1 to 11
  • Year: 1 to 3

include_relative_resources

No

Boolean

-

Specifies whether to include associated resources for renewal price querying.

  • false: Not included.
  • true: Included.

If this parameter is not included in the request or is set to "", the default value false is used.

Request Sample
POST https://bss-intl.myhuaweicloud.com/v2/bills/ratings/period-resources/renew-rate HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ
{
	"resource_ids": ["230221_169ee********9d5b8af6a38f099abea"],
	"period_type": 2,
	"period_num": 1,
        "include_relative_resources": false
}

Response

Response Parameters

Parameter

Parameter Type

Value Range

Description

error_code

String

A maximum of 20 characters

Status code

For details, see Status Codes.

error_msg

String

A maximum of 1,000 characters

Error description

currency

String

A maximum of 20 characters

Currency

USD

If the parameter is left blank, USD is used.

renew_inquiry_results

List<RenewInquiryResultInfo>

--

Renew price inquiry result of the primary resources and their attached resources For details, see Table 1.

official_website_rating_result

OfficialWebsiteRatingResult Object

--

For list price of a primary resource and its attached resources, see Table 2.

optional_discount_rating_results

List<OptionalDiscountRatingResult>

--

Price inquiry result with an optional discount applied. If there are multiple optional discounts, different price inquiry results can be returned with a different discount applied each time. For details, see Table 3 OptionalDiscountRatingResult.

fail_resource_infos

List<FailResourceInfo>

--

Resource information for a failed query. For details, see resource information for a failed query.

Table 1 RenewInquiryResultInfo

Parameter

Parameter Type

Description

resource_id

String

Resource ID.

NOTE:

If the request contains the include_relative_resources field, the ID of the associated primary resource will be returned.

amount

String

Renewal price of primary resources and their attached resources Unit: USD

NOTE:

If the request contains the include_relative_resources field, the renewal amount of the associated primary resource is returned.

Table 2 OfficialWebsiteRatingResult

Parameter

Parameter Type

Value Range

Description

official_website_amount

String

A maximum of 64 characters

List price Unit: USD

Table 3 OptionalDiscountRatingResult

Parameter

Parameter Type

Value Range

Description

discount_id

String

A maximum of 64 characters

Discount ID.

amount

String

A maximum of 64 characters

Final price after the discount Unit: USD

Amount= official_website_amount - discount_amount

official_website_amount

String

A maximum of 64 characters

List price Unit: USD

discount_amount

String

A maximum of 64 characters

Amount of an available discount, such as commercial discounts, partner discounts, promotion discounts, and coupons Unit: USD

discount_type

Integer

A maximum of 32 characters

Discount type

  • Commercial discounts:
    • 605: Contract commercial discount in the Huawei Cloud BE scenario
    • 606: Contract commercial discount in the reseller BE scenario
  • Partner discounts:

    607: Partner authorized discount - discount rate

discount_name

String

A maximum of 256 characters

Discount name

best_offer

Integer

-

Optimal discount or not

  • 0: No (default value)
  • 1: Yes

    Optimal discount is a discount selected from the commercial discount and partner discount. The discount with the maximum discount amount is the optimal discount. If the discount amounts are the same, the system uses the commercial discount first. The promotional discount and coupon are not in the calculation of the optimal discount.

Resource information for a failed query

Parameter

Parameter Type

Description

error_code

String

Status code

For details, see Table Status Codes.

error_msg

String

Error description

resource_id

String

Resource ID.

Status code: 200

Response Sample
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time  
{
	"currency": "CNY",
	"renew_inquiry_results": [{
		"resource_id": "230221_169ee********9d5b8af6a38f099abea",
		"amount": "800.0"
	}],
	"official_website_rating_result": {
		"official_website_amount": "800.0",
		"installment_official_website_amount": null,
		"installment_period_type": null
	},
	"optional_discount_rating_results": [],
	"fail_resource_infos": []
}

Status Codes

  • 4xx: indicates an error resulting from client, such as the request contains bad syntax or an invalid parameter. You need to check the statement and its format and make a request again.
  • 5xx: indicates an error to the Huawei Cloud system, which prevented the system from fulfilling the request from client. You can contact Huawei Cloud customer service to handle the issue.

HTTP Status Code

Error Code

Description

200

CBC.30050007

Renewal price inquiry is not applicable to non-primary resources.

200

CBC.30050008

The period type or number of periods for the resource does not exist.

200

CBC.30050009

The resources have expired and been deleted or do not exist.

200

CBC.30050010

This operation is not allowed because some resources included in your orders are to be paid.

200

CBC.30050011

Resources are being unsubscribed from or changed.

200

CBC.30050013

Renewal not supported.

400

CBC.0100

Incorrect parameter

400

CBC.99006006

The required product cannot be found.

400

CBC.99006024

Failed to query product information.

400

CBC.99006016

Failed to query coupon information.

400

CBC.99006017

Failed to query customer information.

400

CBC.99006050

Incorrect usage unit

400

CBC.99006055

The queried amount exceeds the upper limit.

400

CBC.99006066

Billing query failed

400

CBC.99006073

Project not found.

400

CBC.30050012

There are duplicate resource IDs.

403

CBC.0151

Access denied

403

CBC.0154

Invalid or expired token

500

CBC.0999

Other errors