Help Center > > API Reference> Transaction Management> Managing Resource Packages> Querying the Resource Usage

Querying the Resource Usage

Updated at: Dec 15, 2021 GMT+08:00

Function

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

Constraints

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

URI

POST /v2/payments/free-resources/usages/details/query

Table 1 Header parameter

Parameter

Mandatory

Maximum Length of Characters

Description

X-Language

Yes

A maximum of 8 characters

Language.

  • zh_CN: Chinese
  • en_US: English

Default value: zh_CN

Request

Request Parameters

Parameter

Mandatory

Type

Value Range

Description

free_resource_ids

Yes

List<string>

A maximum of 100 records

List of resource item IDs. Each ID contains a maximum of 64 bytes.

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.

Example Request

POST https://bss-intl.myhuaweicloud.com/v2/payments/free-resources/usages/details/query HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

{
    "free_resource_ids": [
        "d4463497-991b-439d-9ab6-23f9ed197fe9"
    ]
}

Response

Response Parameters

Parameter

Type

Maximum Length of Characters

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_resources

List<FreeResourceDetail>

-

Resource information (resource details) in a resource package. For details, see Table 2.

Table 2 FreeResourceDetail

Parameter

Type

Maximum Length of Characters

Description

free_resource_id

String

A maximum of 64 characters

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

free_resource_type_name

String

-

Resource type name.

quota_reuse_cycle

Integer

-

Reset period. This parameter is valid only when quota_reuse_mode is set to 1 (Resettable).

  • 1: Hour
  • 2: Day
  • 3: Week
  • 4: Month
  • 5: Year

quota_reuse_cycle_type

Integer

-

Reset period type. This field is valid only when quota_reuse_mode is set to 1 (Resettable).

  • 1: Reset by calendar period

    Indicates that the resource package is reset by calendar month or calendar year. For example, if you set quota_reuse_cycle to 4 (month) and quota_reuse_cycle_type to 1, the resource package is reset on the first day of each month.

  • 2: Reset by order period

    Indicates that the resource package is reset by order period. For example, if you set quota_reuse_cycle to 4 (month), quota_reuse_cycle_type to 2, and you purchase this resource package on the 15th day of the month, then the resource package will be reset on the 15th day of each month.

usage_type_name

String

-

Usage type name.

start_time

String

-

Start time. The value is in UTC format.

  • If quota_reuse_mode is set to 1, the value is the start time of the reset period for the current time.
  • If quota_reuse_mode is set to 2, the value is the time when the purchased instance takes effect.

end_time

String

-

End time. The value is in UTC format.

  • If quota_reuse_mode is set to 1, the value is the end time of the reset period for the current time.
  • If quota_reuse_mode is set to 2, the value is the time when the purchased instance becomes invalid.

amount

BigDecimal

-

Remaining resource quota of a package whose quota_reuse_mode is Resettable, that is, the remaining resource quota in the current reset period.

original_amount

BigDecimal

-

Original resource quota of a package whose quota_reuse_mode is Resettable, that is, the total resource quota in each reset period.

measure_id

Integer

-

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

Example Response

HTTP/1.1 200 OK

Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time 

{
    "free_resources": [
        {
            "free_resource_id": "d4463497-991b-439d-9ab6-23f9ed197fe9",
            "free_resource_type_name": "test1",
            "quota_reuse_cycle": 4,
            "quota_reuse_cycle_type": 1,
            "usage_type_name": "Duration",
            "start_time": "2021-04-30T03:30:56Z",
            "end_time": "2021-05-31T15:59:59Z",
            "amount": 100,
            "original_amount": 100,
            "measure_id": 37
        }
    ]
}

Returned Values

HTTP Status Code

Error Code

Description

400

CBC.0100

Incorrect parameter.

403

CBC.0151

Access denied.

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