Partner CenterPartner Center

Compute
Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
Domain Name Service
VPC Endpoint
Cloud Connect
Enterprise Switch
Security & Compliance
Anti-DDoS
Web Application Firewall
Host Security Service
Data Encryption Workshop
Database Security Service
Advanced Anti-DDoS
Data Security Center
Container Guard Service
Situation Awareness
Managed Threat Detection
Compass
Cloud Certificate Manager
Anti-DDoS Service
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GaussDB NoSQL
GaussDB(for MySQL)
Distributed Database Middleware
GaussDB(for openGauss)
Developer Services
ServiceStage
Distributed Cache Service
Simple Message Notification
Application Performance Management
Application Operations Management
Blockchain Service
API Gateway
Cloud Performance Test Service
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
DevCloud
ProjectMan
CodeHub
CloudRelease
CloudPipeline
CloudBuild
CloudDeploy
Cloud Communications
Message & SMS
Cloud Ecosystem
Marketplace
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP License Service
Support Plans
Customer Operation Capabilities
Partner Support Plans
Professional Services
enterprise-collaboration
Meeting
IoT
IoT
Intelligent EdgeFabric
DeveloperTools
SDK Developer Guide
API Request Signing Guide
Terraform
HCloud CLI
Updated at: Apr 27, 2022 GMT+08:00

Querying the Price of a Pay-Per-Use Product

Function

Partners can query the price of a pay-per-use product by criteria on the 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 tenant has enjoyed multiple types discounts, the system will return the commercial discount amount and the final price preferentially.

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/on-demand-resources

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<DemandProductInfo>

A maximum of 100 values

Indicates the product information list. For details, see Table 1.

inquiry_precision

No

Integer

-

Precision of the price query result.

  • 0: The default precision of the query result. The result contains a maximum of six decimal places with the unit of USD, such as USD 0.000001.
  • 1: The result contains a maximum of 10 decimal places with the unit of USD, such as USD 1.0000000001.
NOTE:

Value 0 and value 1 make differences only when the query result contains at least six decimal places.

Table 1 DemandProductInfo

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 for 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
  • EVS
    • SATA: common I/O EVS disk
    • SAS: high I/O EVS disk
    • GPSSD: general-purpose SSD EVS disk
    • SSD: ultra-high I/O EVS disk

region

Yes

String

A maximum of 64 characters

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

usage_factor

Yes

String

A maximum of 64 characters

Usage factor. The value is the same as the usage factor value in the SDR. The mapping between cloud services and usage factors is as follows:

  • Cloud server: Duration
  • Cloud disk: Duration
  • EIP: Duration
  • Bandwidth: Duration or upflow
  • Marketplace image: Duration

You can call the API in Querying Usage Types to obtain the value of parameter code in Table 3. The value indicates the billing factor of each cloud service.

usage_value

Yes

BigDecimal

-

Usage value.

For example, if you want to inquire a product price by hour, set usageValue to 1 and usageMeasureID to 4 (hour).

usage_measure_id

Yes

Integer

A maximum of 4 characters

Usage unit. You can call the API in Querying Measurement Units to obtain the value.

For example, if you want to inquire a product price by hour, set usageValue to 1 and usageMeasureID to 4 (hour).

subscription_num

Yes

Integer

[1-10000]

Number of subscriptions.

available_zone

No

String

A maximum of 64 characters

AZ ID.

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

A maximum of 4 characters

Resource capacity measurement ID. The options are:

  • 15: Mbit/s (used when the bandwidth is subscribed)
  • 17: GB (used when an EVS disk is subscribed to)
  • 14: amount (times)

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/on-demand-resources HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ
{
    "project_id": "06488a********832f55c016b0e337d7",
    "product_infos": [
        {
            "id": "1",
            "cloud_service_type": "hws.service.type.ec2",
            "resource_type": "hws.resource.type.vm",
            "resource_spec": "c3.3xlarge.2.linux",
            "region": "cn-east-3",
            "usage_factor": "Duration",
            "usage_value": 2,
            "usage_measure_id": 4,
            "subscription_num": 1,
            "available_zone": null
        },
        {
            "id": "2",
            "cloud_service_type": "hws.service.type.ebs",
            "resource_type": "hws.resource.type.volume",
            "resource_spec": "SSD",
            "region": "cn-north-1",
            "usage_factor": "Duration",
            "usage_value": 2,
            "usage_measure_id": 4,
            "subscription_num": 1,
            "resource_size": 10,
            "size_measure_id": 17
        },
        {
            "id": "3",
            "cloud_service_type": "hws.service.type.vpc",
            "resource_type": "hws.resource.type.ip",
            "resource_spec": "5_bgp",
            "region": "cn-east-3",
            "usage_factor": "Duration",
            "usage_value": 3,
            "usage_measure_id": 4,
            "subscription_num": 1,
            "available_zone": null
        },
        {
            "id": "4",
            "cloud_service_type": "hws.service.type.vpc",
            "resource_type": "hws.resource.type.bandwidth",
            "resource_spec": "12_sbgp",
            "region": "cn-north-1",
            "usage_factor": "upflow",
            "usage_value": 4,
            "usage_measure_id": 10,
            "subscription_num": 1,
            "available_zone": "cn-north-1a",
            "resource_size": 1,
            "size_measure_id": 15
        }
    ],
    "inquiry_precision": 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.

amount

BigDecimal

-

Final price after discount

discount_amount

BigDecimal

-

Discount amount (difference between the official website price and final price).

official_website_amount

BigDecimal

-

Price of a pay-per-use product on the official website.

measure_id

Integer

A maximum of 4 characters

Measurement unit ID.

1: Yuan/Dollar

currency

String

A maximum of 20 characters

Currency.

USD

If the parameter is left blank, USD is used.

product_rating_results

List<DemandProductRatingResult>

-

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

Table 2 DemandProductRatingResult

Parameter

Type

Value Range

Description

id

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.

product_id

String

A maximum of 64 characters

Product ID.

amount

BigDecimal

-

Final price after discount

discount_amount

BigDecimal

-

Discount amount (difference between the official website price and final price).

official_website_amount

BigDecimal

-

Price of a pay-per-use product on the official website.

measure_id

Integer

A maximum of 4 characters

Measurement unit ID.

1: Yuan/Dollar

discount_rating_results

List<DemandDiscountRatingResult>

-

Discount details, including the product promotion information and commercial or partner discount information. For details, see Table 3.

Table 3 DemandDiscountRatingResult

Parameter

Type

Value Range

Description

discount_id

String

A maximum of 64 characters

Discount ID.

discount_type

Integer

A maximum of 4 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

amount

BigDecimal

-

Discounted amount.

measure_id

Integer

A maximum of 4 characters

Measurement unit ID.

1: Yuan/Dollar

discount_name

String

A maximum of 256 characters

Discount name.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time 
{
    "amount": 8.128,
    "discount_amount": 0.0,
    "official_website_amount": 8.128,
    "measure_id": 1,
    "currency": "USD",
    "product_rating_results": [
        {
            "id": "1",
            "product_id": "00301-243025-0--0_merge",
            "amount": 5.48,
            "discount_amount": 0.0,
            "official_website_amount": 5.48,
            "measure_id": 1,
            "discount_rating_results": []
        },
        {
            "id": "2",
            "product_id": "00301-290407774-0--1",
            "amount": 0.028,
            "discount_amount": 0.0,
            "official_website_amount": 0.028,
            "measure_id": 1,
            "discount_rating_results": []
        },
        {
            "id": "3",
            "product_id": "00301-238601-0--0_merge",
            "amount": 0.06,
            "discount_amount": 0.0,
            "official_website_amount": 0.06,
            "measure_id": 1,
            "discount_rating_results": []
        },
        {
            "id": "4",
            "product_id": "00301-290407706-0--1",
            "amount": 2.56,
            "discount_amount": 0.0,
            "official_website_amount": 2.56,
            "measure_id": 1,
            "discount_rating_results": []
        }
    ]
}

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.

400

CBC.99006074

The billing item does not exist.

403

CBC.0151

Access denied.

500

CBC.0999

Other errors.

Did you find this page helpful?

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