Help Center/ Customer Operation Capabilities/ API Reference/ Appendix/ Price Inquiry API Guide/ Price Inquiry Example of Pay-Per-Use Products (Using the Price Calculator)
Updated on 2025-11-04 GMT+08:00

Price Inquiry Example of Pay-Per-Use Products (Using the Price Calculator)

The request parameters for querying the price of a pay-per-use product using an API can be obtained through the price calculator.

ECS is used as an example:

Region: EU-Dublin

AZ: General AZ

Billing Mode: Pay-per-use

CPU Architecture: x86

Type: General computing-plus C6 | 2 vCPUs | 4 GB

System Disk: General Purpose SSD 40 GB

Required Duration: 1 Month

Quantity: 1

  1. Go to the Price Calculator page and press F12 to open the console. Set the parameters based on the example.

  2. Click Network > resource > Payload to view request parameters.

  3. Add the parameters obtained in Step 2 to the request.

    As there are three products, an ECS, a VPC, and an EVS disk, involved, three product_infos structures are required. The following shows an example of a product_infos structure.

    {
         "project_id": "fa4***************f0",
         "product_infos": [
              {
                "id": "0",
                "cloud_service_type": "hws.service.type.ec2",
                "resource_type": "hws.resource.type.vm",
                "resource_spec": "c6.large.2.linux",
                "region": "eu-west-101",
                "usage_factor": "Duration",
                "usage_value": 1,
                "usage_measure_id": 4,
                "subscription_num": 1
             },
             {
               "id": "1",
               "cloud_service_type": "hws.service.type.ebs",
               "resource_type": "hws.resource.type.volume",
               "resource_spec": "GPSSD",
               "region": "eu-west-101",
               "resource_size": 40,
               "size_measure_id": 17,
               "usage_factor": "Duration",
               "usage_value": 1,
               "usage_measure_id": 4,
               "subscription_num": 1
            },
            {
              "id": "2",
              "cloud_service_type": "hws.service.type.vpc",
              "resource_type": "hws.resource.type.bandwidth",
              "resource_spec": "19_bgp",
              "region": "eu-west-101",
              "resource_size": 5,
              "size_measure_id": 15,
              "usage_factor": "Duration",
              "usage_value": 1,
              "usage_measure_id": 4,
              "subscription_num": 1
          }
       ]
    }

  4. (Optional) Go to API Explorer and add product_infos to the request body. The same results will return as that obtained using the price calculator.