Querying the Price of a Yearly/Monthly Product
Function
Customers can use this API to query prices of yearly/monthly products for new subscriptions on their platforms.
If the tenant who purchases the product enjoys a discount, the discount amount and the final price can be obtained from the query result.
If the customer enjoys multiple discounts, the system returns the rating result for each discount. The system preferentially uses the rating result of the commercial discount if the customer selects automatic payment.
- Ensure that you provide the correct service type, region, resource type, region and resource specification. Otherwise, an error may be reported.
- You can use the to determine product prices.
- You can also use the price calculator to get the value of the product_infos request parameter when you call the API for querying product prices. For more details, see price inquiry examples.
Constraints
This API can be invoked using the AK/SK or token of the customer.
URI
POST /v2/bills/ratings/period-resources/subscribe-rate
Request
Request Parameters
Parameter |
Mandatory |
Type |
Value Range |
Description |
---|---|---|---|---|
project_id |
Yes |
String |
A maximum of 64 characters |
Project ID.
NOTE:
|
product_infos |
Yes |
List<PeriodProductInfo> |
A maximum of 100 values |
Product information list. For details, see Table 1. |
Parameter |
Mandatory |
Type |
Value Range |
Description |
---|---|---|---|---|
id |
Yes |
String |
A maximum of 64 characters |
The ID is used to identify the mapping between the inquiry result and the request and must be unique in an inquiry. |
cloud_service_type |
Yes |
String |
A maximum of 400 characters |
Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. To obtain a specific service type, call the API in Querying Cloud Service Types. |
resource_type |
Yes |
String |
A maximum of 400 characters |
Resource type code. For example, the VM resource type code of ECS is hws.resource.type.vm. To obtain a specific resource type, call the API in Querying Resource Types. The relationship between ResourceType and CloudServiceType is as follows: A resource type represents a resource contained in the cloud service type, and the cloud service type is a combination of multiple resource types. |
resource_spec |
Yes |
String |
A maximum of 400 characters |
Resource specifications. For details, see related cloud service documentation. The following provides examples of services and resource specifications:
|
region |
Yes |
String |
A maximum of 64 characters |
Cloud service region code, for example, eu_west_101. |
period_type |
Yes |
Integer |
[0-4] |
Period type of a yearly/monthly product order.
|
period_num |
Yes |
Integer |
[1-214783647] |
Number of periods of a yearly/monthly product order. |
subscription_num |
Yes |
Integer |
[1-10000] |
Number of subscriptions of a yearly/monthly product order. |
available_zone |
No |
String |
A maximum of 64 characters |
AZ identifier, for example, cn-north-1a. AZ identifiers are case-insensitive. If this parameter is not included in the request parameters, is set to "", or is set to null, it cannot be used as a filter criterion. |
resource_size |
No |
Integer |
[1-214783647] |
Resource capacity. It can be the subscribed volume size or bandwidth size. This parameter is mandatory for a linear product. Linear products are those whose size must be specified during a subscription, such as hard disks and bandwidth. For example, you can select 10 GB or 20 GB during a disk subscription. For non-linear products, if this parameter is not included in the request parameters or is set to null, it cannot be used as a filter criterion. |
size_measure_id |
No |
Integer |
- |
Resource capacity measurement ID. The options are as follows:
This parameter is mandatory for a linear product. Linear products are those whose size must be specified during a subscription, such as hard disks and bandwidth. For example, you can select 10 GB or 20 GB during a disk subscription. For non-linear products, if this parameter is not included in the request parameters or is set to null, it cannot be used as a filter criterion. |
POST https://bss.myhuaweicloud.eu/v2/bills/ratings/period-resources/subscribe-rate HTTP/1.1 Content-Type: application/json X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ { "project_id": "84c53ec51e794a4888fb0f5c0cfb24208b9a7edf90024702adbec2b2fd72e5f2", "product_infos": [ { "id": "1", "cloud_service_type": "hws.service.type.ec2", "resource_type": "hws.resource.type.vm", "resource_spec": "c6.2xlarge.2.linux", "region": "eu-west-101", "available_zone": "eu-west-101a", "resource_size": null, "size_measure_id": null, "period_type": 2, "period_num": 1, "subscription_num": 1 }, { "id": "2", "cloud_service_type": "hws.service.type.vpc", "resource_type": "hws.resource.type.ip", "resource_spec": "5_bgp", "region": "eu-west-101", "available_zone": null"eu-west-101a", "resource_size": null, "size_measure_id": 15, "period_type": 2, "period_num": 1, "subscription_num": 1 }, { "id": "3", "cloud_service_type": "hws.service.type.ebs", "resource_type": "hws.resource.type.volume", "resource_spec": "GPSSD", "region": "eu-west-101", "available_zone": "eu-west-101a", "resource_size": 40, "size_measure_id": 17, "period_type": 2, "period_num": 1, "subscription_num": 1 }, { "id": "4", "cloud_service_type": "hws.service.type.vpc", "resource_type": "hws.resource.type.bandwidth", "resource_spec": "19_bgp", "region": "eu-west-101", "available_zone":"eu-west-101a", "resource_size": 40, "size_measure_id": 15, "period_type": 2, "period_num": 1, "subscription_num": 1 } ] }
Response
Response Parameters
Parameter |
Type |
Value Range |
Description |
---|---|---|---|
error_code |
String |
A maximum of 20 characters |
Status code. For details, see Returned Values. This parameter is returned only when the query failed. |
error_msg |
String |
A maximum of 1000 characters |
Error description. This parameter is returned only when the query failed. |
official_website_rating_result |
List<OfficialWebsiteRatingResult Object> |
- |
The result for querying the list price of a yearly/monthly product. For details, see Table 2. |
optional_discount_rating_results |
List<OptionalDiscountRatingResult> |
- |
Rating results by discount if optional discounts exist. Each optional discount has a rating result. For details, see Table 4. |
currency |
String |
A maximum of 20 characters |
Currency. USD If the parameter is left blank, USD is used. |
Parameter |
Type |
Value Range |
Description |
---|---|---|---|
official_website_amount |
BigDecimal |
- |
Price of a yearly/monthly product on the official website. |
measure_id |
Integer |
A maximum of 4 characters |
Measurement unit ID. 1: USD |
product_rating_results |
List<PeriodProductOfficialRatingResult> |
- |
Price query result. For details, see Table 3. |
Parameter |
Type |
Value Range |
Description |
---|---|---|---|
id |
String |
A maximum of 64 characters |
ID, which comes from the ID in the request. |
product_id |
String |
A maximum of 64 characters |
Yearly/monthly product ID. |
official_website_amount |
BigDecimal |
- |
Price of a yearly/monthly product on the official website. |
measure_id |
Integer |
A maximum of 4 characters |
Measurement unit ID.
|
Parameter |
Type |
Value Range |
Description |
---|---|---|---|
discount_id |
String |
A maximum of 64 characters |
Discount ID. |
amount |
BigDecimal |
- |
Final price after the discount. Amount= official_website_amount - discountAmount |
official_website_amount |
BigDecimal |
- |
Price of a yearly/monthly product on the official website. |
discount_amount |
BigDecimal |
- |
Amount of an available discount, such as commercial discounts, partner discounts, promotion discounts, and coupons. |
measure_id |
Integer |
A maximum of 4 characters |
Measurement unit ID. 1: USD |
discount_type |
Integer |
A maximum of 32 characters |
Discount type. |
discount_name |
String |
A maximum of 256 characters |
Discount name. |
best_offer |
Integer |
- |
Optimal discount.
|
product_rating_results |
List<PeriodProductRatingResult> |
- |
Product price query result. For details, see Table 5. |
Parameter |
Type |
Value Range |
Description |
---|---|---|---|
id |
String |
A maximum of 64 characters |
ID, which comes from the ID in the request. |
product_id |
String |
A maximum of 64 characters |
Yearly/monthly product ID. |
amount |
BigDecimal |
- |
Final price after the discount. Amount= official_website_amount - discountAmount |
official_website_amount |
BigDecimal |
- |
Price of a yearly/monthly product on the official website. |
discount_amount |
BigDecimal |
- |
Amount of an available discount, such as commercial discounts, partner discounts, promotion discounts, and coupons. |
measure_id |
Integer |
A maximum of 4 characters |
Measurement unit ID. 1: USD |
Example Response
HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Content-Length: length Date: response time { "official_website_rating_result": { "official_website_amount": 529.67, "installment_official_website_amount": null, "installment_period_type": null, "measure_id": 1, "product_rating_results": [ { "id": "1", "product_id": "OFFI777523764289028104, "official_website_amount": 182.07, "measure_id": 1, "installment_official_website_amount": null, "installment_period_type": null }, { "id": "2", "product_id": "OFFI777346878061772800", "official_website_amount": 0.0, "measure_id": 1, "installment_official_website_amount": null, "installment_period_type": null }, { "id": "3", "product_id": "OFFI776402238127517698", "official_website_amount": 5.6, "measure_id": 1, "installment_official_website_amount": null, "installment_period_type": null }, { "id": "4", "product_id": "OFFI777135464818663425", "official_website_amount": 342.0, "measure_id": 1, "installment_official_website_amount": null, "installment_period_type": null } ] }, "optional_discount_rating_results": [], "currency": "USD" }
Returned Values
- 4xx: This class of HTTP status code is intended for situations in which the error seems to have been caused by the client, for example, the request contains bad syntax or incorrect parameters. You must ensure the request is correct.
- 5xx: This class of HTTP status code is intended for cases in which the Huawei Cloud server is aware that it has encountered an error or is otherwise incapable of performing the request. In this case, contact Huawei Cloud customer service.
HTTP Value |
Error Code |
Description |
---|---|---|
400 |
CBC.0100 |
Parameter error. |
400 |
CBC.99006006 |
Product not found. |
400 |
CBC.99006055 |
The queried amount exceeds the upper limit. |
403 |
CBC.0151 |
Access denied. |
429 |
CBC.0250 |
Connection request control triggered. |
500 |
CBC.0999 |
Other errors. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.