Updated on 2024-10-29 GMT+08:00

Querying Resource Package Usage Details

Function

Customers can query the resource usage details on the partner sales platform.

Constraints

This API can be invoked only by the customer AK/SK or token.

Debugging

You can debug this API in API Explorer. Automatic authentication is supported. API Explorer can automatically generate and debug example SDK code.

URI

GET /v2/bills/customer-bills/free-resources-usage-records

Table 1 Request parameters

Parameter

Mandatory

Type

Value Range

Description

free_resource_id

No

String

A maximum of 64 characters

Resource ID. A resource package contains multiple resources, and a resource has a usage type. The resource ID is obtained from the response of the API in Querying Resource Packages.

If this parameter is not included or is left empty, it will not be used as a filter criterion.

product_id

No

String

A maximum of 64 characters

Product ID, that is, resource package ID.

If this parameter is not included or is left empty, it cannot be used as a filter criterion.

resource_type_code

No

String

A maximum of 64 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.

If this parameter is not included or is left empty, it will not be used as a filter criterion.

deduct_time_begin

Yes

String

A maximum of 10 characters

Start time of resources deduction, which is in YYYY-MM-DD format (GMT+08:00).

deduct_time_end

Yes

String

A maximum of 10 characters

End time of resource deduction, which is in YYYY-MM-DD format (GMT+08:00).

NOTE:

The gap between the start time and end time must be less than or equal to 90 days.

offset

No

Integer

0 to a maximum integer

Offset, starting from 0. The default value is 0.

NOTE:

This parameter is used for pagination. Retain its default value 0 if pagination is not required. offset indicates the offset relative to the first data record among all that meets the conditions configured. If you set offset to 1, the second and subsequent data records are returned.

For example, if there are 10 records that meet query conditions, when you set limit to 10 and offset to 1, the second to the tenth records are returned.

If there are 20 records that meet query conditions, when you set offset to 0 and limit to 10 for the first page and set offset to 10 and limit to 10 for the second page, then each page will respectively have 10 records.

limit

No

Integer

[1-1000]

Maximum number of records in each query. The default value is 10.

Request

Request Parameters

None

Example Request

GET https://bss-intl.myhuaweicloud.com/v2/bills/customer-bills/free-resources-usage-records?free_resource_id=free_resource_id&product_id=product_id&resource_type_code=resource_type_code&deduct_time_begin=2021-10-01&deduct_time_end=2021-10-31&offset=0&limit=10 HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

Response

Response Parameters

Parameter

Type

Value Range

Description

error_code

String

20

Error code.

For details, see Returned Values. This parameter is returned only when the query failed.

error_msg

String

1000

Error description.

This parameter is returned only when the query failed.

free_resource_records

List<FreeResourceRecord>

Maximum number: 1000

Resource package usage details. For details, see Table 2.

total_count

Integer

-

Total number of records that meet the conditions.

Table 2 FreeResourceRecord

Parameter

Type

Value Range

Description

deduct_time

String

A maximum of 20 characters

Time when a resource is deducted.

UTC time. The format is yyyy-MM-dd'T'HH:mm:ss'Z', for example, 2021-10-13T10:01:49Z.

free_resource_id

String

A maximum of 64 characters

Resource ID. A resource package contains multiple resources, and a resource has a usage type.

resource_id

String

A maximum of 64 characters

Resource ID.

resource_type_code

String

A maximum of 64 characters

Resource type code. For example, the resource type code of VM is hws.resource.type.vm.

resource_type_name

String

A maximum of 200 characters

Resource type. For example, the resource type of ECS is Cloud Host.

resource_tag

String

A maximum of 10,240 characters

Resource tag.

product_id

String

A maximum of 64 characters

Product ID, that is, resource package ID.

product_name

String

A maximum of 256 characters

Product name, that is, resource package name.

usage_type_code

String

A maximum of 64 characters

Usage type

available_amount

String

A maximum of 64 characters

Available resources before deduction

remaining_amount

String

A maximum of 64 characters

Available resources after deduction.

used_amount

String

A maximum of 64 characters.

Deducted resource amount.

measure_id

Integer

-

Measurement unit of the quota of a free resource package. Call the API in Querying Measurement Units to obtain the value.

effective_time

String

A maximum of 20 characters

Start time of using a resource (UTC time).

expire_time

String

A maximum of 20 characters

End time of resource usage (UTC time).

Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time 
{
    "free_resource_records": [
        {
            "deduct_time": "2021-10-19T08:04:25Z",
            "free_resource_id": "43248428-8409-47cd-b115-6a5872e2200b",
            "resource_id": "resourceInstanceId_north1_obs_10120001112",
            "resource_type_code": "",
            "resource_tag": "--",
            "product_id": "90301-247012-0--0",
            "product_name": "OBS storage package 10 TB Monthly subscription Beijing7",
            "usage_type_code": "",
            "available_amount": "10190",
            "remaining_amount": "10140",
            "used_amount": "50",
            "measure_id": 10,
            "effective_time": "2021-10-13T10:01:49Z",
            "expire_time": "2021-10-13T11:00:00Z"
        }
    ],
    "total_count": 1
}

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 Status Code

Error Code

Description

400

CBC.0100

Incorrect parameter.

403

CBC.0151

Access denied.

500

CBC.0999

Other errors.