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

Viewing Resource Usage Details (Old)

Function

This API can be used to query usage details of each resource for a customer on the self-built platform.

Note:

  • This API can be invoked only using the AK/SK or token of the customer.
    • This API will be taken offline. For details about the new API for querying resource usage details, see Viewing Resource Usage Details.
    • After a customer associates with an enterprise master in the unified accounting model, bill queries will return both bills before and after the association.
    • You can query data from the past three years.

URI

GET /v1.0/{domain_id}/customer/account-mgr/bill/res-records

The following table describes the parameters.

Table 1 URI parameters

Parameter

Mandatory

Maximum Length of Characters

Description

domain_id

Yes

A maximum of 64 characters

Customer account ID. For details, see How Do I Obtain Customer's customer_id and domain_id Values?

Table 2 Request parameters

Parameter

Mandatory

Type

Maximum Length of Characters/Value Range

Description

cycle

Yes

String

A maximum of 8 characters

Billing cycle. The value is in "YYYY-MM" format.

Example: 2020-01

cloudServiceTypeCode

No

String

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

If this parameter is not included in the request parameters or is left empty, it cannot be used as a filter criterion. If it is set to null, it can be used as a filter criterion. This parameter cannot be set to "".

resourceTypeCode

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 in the request parameters or is left empty, it cannot be used as a filter criterion. If it is set to null, it can be used as a filter criterion. This parameter cannot be set to "".

regionCode

No

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.

If this parameter is not included in the request parameters or is left empty, it cannot be used as a filter criterion. If it is set to null, it can be used as a filter criterion. This parameter cannot be set to "".

resInstanceId

No

String

A maximum of 256 characters

Resource instance ID.

payMethod

Yes

String

A maximum of 4 characters

Payment method. The options are:

  • 0: Yearly/monthly
  • 1: Pay-per-use
  • 10: Reserved instance

enterpriseProjectId

No

String

A maximum of 64 characters

Enterprise project ID.

  • 0: ID of a default project
  • – 1: The service does not support enterprise project management.

If this parameter is not included in the request parameters or is left empty, it cannot be used as a filter criterion. If it is set to null, it can be used as a filter criterion. This parameter cannot be set to "".

offset

Yes

Integer

[1-Maximum integer]

Page number.

limit

Yes

Integer

[1-1000]

Page limit.

Request

Request Parameters

None

Example Request

GET https://bss-intl.myhuaweicloud.com/v1.0/{domain_id}/customer/account-mgr/bill/res-records?cycle=2019-06&payMethod=0&offset=1&limit=10 HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

Response

Response Parameters

Parameter

Mandatory

Type

Maximum Length of Characters

Description

error_code

No

String

A maximum of 16 characters

Error code. For details, see Status Code. This parameter is returned only when a failure occurs.

error_msg

No

String

A maximum of 1024 characters

Error description. This parameter is returned only when a failure occurs.

monthlyRecords

No

List<MonthlyRecord>

N/A

Resource usage record.

For details, see Table 3.

totalCount

No

Int

N/A

Number of result sets. This parameter is returned only when the query is successful.

currency

No

String

A maximum of 3 characters

Currency.

USD

Table 3 MonthlyRecord

Parameter

Mandatory

Type

Maximum Length of Characters/Value Range

Description

cloudServiceTypeCode

No

String

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

regionCode

No

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.

resourceTypeCode

No

String

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

resInstanceId

No

String

A maximum of 256 characters

Resource instance ID.

resourceName

No

String

-

Resource name. When creating a resource, a customer can enter the resource name. Some resource names can also be changed during resource management.

resourceTag

No

String

A maximum of 8,192 characters

Resource tag. Customers can set tags when managing resources.

consumeAmount

No

Number

-

Amount of expenditures of a customer on cloud services, including the cash coupons. The value of this parameter is accurate to twotwo decimal places.

cycle

No

String

-

Expenditure month.

measureId

No

Integer

[1-2]

Unit.

  1. USD
  2. Cent

enterpriseProjectId

No

String

-

Enterprise project ID.

  • 0: ID of a default project
  • null: The service does not support enterprise project management.

payMethod

No

String

[0-1]

Billing mode.

0: Yearly/monthly

1: Pay-per-use

10: Reserved instance

officialAmount

No

Number

-

Standard price.

Example Response

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

{
	"monthlyRecords": [{
			"cloudServiceTypeCode": "hws.service.type.marketplace",
			"regionCode": "cn-north-1",
			"resourceTypeCode": "hws.resource.type.marketplace",
			"resInstanceId": null,
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 0,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": null,
			"payMethod": "0",
                        "officialAmount": 10
		},
		{
			"cloudServiceTypeCode": "hws.service.type.marketplace",
			"regionCode": "cn-north-1",
			"resourceTypeCode": "hws.resource.type.marketplace",
			"resInstanceId": "00*****aae",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 600,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": null,
			"payMethod": "0",
                        "officialAmount": 10
		},
		{
			"cloudServiceTypeCode": "hws.service.type.ebs",
			"regionCode": "cn-north-1",
			"resourceTypeCode": "hws.resource.type.volume",
			"resInstanceId": "005*****1b8c",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 10000,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": "0",
			"payMethod": "0",
                        "officialAmount": 10
		},
		{
			"cloudServiceTypeCode": "hws.service.type.ebs",
			"regionCode": "cn-north-1",
			"resourceTypeCode": "hws.resource.type.volume",
			"resInstanceId": "06c*****88a",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 10000,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": "0",
			"payMethod": "0",
                        "officialAmount": 10
		},
		{
			"cloudServiceTypeCode": "hws.service.type.ebs",
			"regionCode": "cn-north-1",
			"resourceTypeCode": "hws.resource.type.volume",
			"resInstanceId": "08*****23",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 9500,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": "0",
			"payMethod": "0",
                        "officialAmount": 10
		},
		{
			"cloudServiceTypeCode": "hws.service.type.marketplace",
			"regionCode": "cn-north-7",
			"resourceTypeCode": "hws.resource.type.marketplace",
			"resInstanceId": "0fa*****21e",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 400,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": null,
			"payMethod": "0",
                        "officialAmount": 10
		},
		{
			"cloudServiceTypeCode": "hws.service.type.ebs",
			"regionCode": "cn-north-1",
			"resourceTypeCode": "hws.resource.type.volume",
			"resInstanceId": "0ff*****04d",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 10000,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": "0",
			"payMethod": "0",
                        "officialAmount": 10
		},
		{
			"cloudServiceTypeCode": "hws.service.type.ebs",
			"regionCode": "cn-north-1",
			"resourceTypeCode": "hws.resource.type.volume",
			"resInstanceId": "1b92*****8c2",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 10000,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": "0",
			"payMethod": "0",
                        "officialAmount": 10
		},
		{
			"cloudServiceTypeCode": "hws.service.type.marketplace",
			"regionCode": "cn-north-1",
			"resourceTypeCode": "hws.resource.type.marketplace",
			"resInstanceId": "1e4*****6a1",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 600,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": null,
			"payMethod": "0",
                        "officialAmount": 10
		},
		{
			"cloudServiceTypeCode": "hws.service.type.ebs",
			"regionCode": "cn-north-1",
			"resourceTypeCode": "hws.resource.type.volume",
			"resInstanceId": "295*****448a1",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 10000,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": "0",
			"payMethod": "0",
                        "officialAmount": 10
		}
	],
	"totalCount": 33,
	"currency": "USD"
}

Status Code

  • 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

Unknown error.