Help Center > > API Reference> Product Management> Querying the Price of a Product> Querying the Price of a Yearly/Monthly Product

Querying the Price of a Yearly/Monthly Product

Updated at: Jan 25, 2022 GMT+08:00

Function

This API is used to query the price of a yearly/monthly product by criteria on the partner sales platform.

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.

HUAWEI CLOUD allows you to query products by service type, service region, resource type, and resource specification. Ensure that you enter correct criteria for search. Otherwise, the API returns an error indicating that the product cannot be found.

Constraints

This API can be invoked using the customer token replaced by the partner token.

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:

Obtain it in the following way:

Step 1: Call the IAM API for obtaining an agency token to obtain the customer token.

Step 2: Obtain the project ID by referring to Step 2 in How Can I Replace a Partner Token with a Customer Token.

product_infos

Yes

List<PeriodProductInfo>

A maximum of 100 values

Product information list. For details, see Table 1.

Table 1 PeriodProductInfo

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 of cloud service types. The following gives some examples of mappings between resource specifications and cloud service types.

  • ECS

    Add .win or .linux to the end of the ECS flavor ID based on the OS type, for example, s2.small.1.linux. Call the API in Querying Details About Flavors and Extended Flavor Information to obtain the flavor IDs.

  • Bandwidth
    • 12_bgp: dynamic BGP bandwidth billed by traffic
    • 12_sbgp: static BGP bandwidth billed by traffic
    • 19_bgp: dynamic BGP bandwidth billed by bandwidth
    • 19_sbgp: static BGP bandwidth billed by bandwidth
    • 19_share: shared bandwidth billed by bandwidth
  • IP address:
    • 5_bgp: dynamic BGP public IP address
    • 5_sbgp: static BGP public IP address
  • RDS:

    You can call the API for querying database specifications to obtain the RDS specifications.

  • DCS:

    You can call the API for querying service specifications to obtain the DCS specifications.

region

Yes

String

A maximum of 64 characters

Cloud service region code, for example, cn-north-1. Obtain the value from the Region column in Regions and Endpoints.

period_type

Yes

Integer

[0-4]

Period type of a yearly/monthly product order.

  • 0: Day
  • 2: Month
  • 3: Year
  • 4: Hour

period_num

Yes

Integer

-

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, for example, cn-north-1a. For details, see Regions and Endpoints.

resource_size

No

Integer

-

Resource capacity. It can be the subscribed volume size or bandwidth size.

This parameter must be set 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.

size_measure_id

No

Integer

-

Resource capacity measurement ID. The options are as follows:

  • 15: Mbit/s (used when the bandwidth is subscribed)
  • 17: GB (used when a cloud disk is subscribed)
  • 14: amount

This parameter must be set 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.

Example Request
POST https://bss-intl.myhuaweicloud.com/v2/bills/ratings/period-resources/subscribe-rate HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ
{
    "project_id": "84c53ec51e794a4888fb0f5c0cfb2420",
    "product_infos": [
        {
            "id": "1",
	   "cloud_service_type": "hws.service.type.ec2",
	   "resource_type": "hws.resource.type.vm",
   	   "resource_spec": "s3.medium.4.linux",
	   "region": "cn-east-3",
	   "available_zone": "cn-east-3a",
	   "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": "cn-east-3",
	   "available_zone": null,
	   "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": "cn-east-3",
	   "available_zone": "cn-east-3a",
	   "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": "cn-east-3",
	   "available_zone": "cn-east-3a",
	   "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

OfficialWebsiteRatingResult Object

-

Queried price listed on the official website for the 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.

Table 2 OfficialWebsiteRatingResult

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: 1 Yuan/Dollar

product_rating_results

List<PeriodProductOfficialRatingResult>

-

Queried price of the yearly/monthly product. For details, see Table 3.

Table 3 PeriodProductOfficialRatingResult

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.

1: Yuan/Dollar

Table 4 OptionalDiscountRatingResult

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: Yuan/Dollar

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_name

String

A maximum of 256 characters

Discount name.

best_offer

Integer

-

Optimal discount.

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

    Optimal discount: The system selects a discount 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.

product_rating_results

List<PeriodProductRatingResult>

-

Product price query result. For details, see Table 5.

Table 5 PeriodProductRatingResult

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: Yuan/Dollar

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": 3022.8,
        "measure_id": 1,
        "product_rating_results": [
            {
                "id": "3",
                "product_id": "90301-755002-0--0",
                "official_website_amount": 0.0,
                "measure_id": 1
            },
            {
                "id": "4",
                "product_id": "90301-686009-0--0",
                "official_website_amount": 2915.0,
                "measure_id": 1
            },
            {
                "id": "1",
                "product_id": "00301-290407480-0--1",
                "official_website_amount": 107.8,
                "measure_id": 1
            },
            {
                "id": "2",
                "product_id": "90301-686010-0--0",
                "official_website_amount": 0.0,
                "measure_id": 1
            }
        ]
    },
    "optional_discount_rating_results": [],
    "currency": "USD"
}

Returned Values

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.

400

CBC.99006074

The billing item does not exist.

403

CBC.0151

Access denied.

429

CBC.0250

Connection request control triggered.

500

CBC.0999

Other errors.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel