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

Viewing Resource Expenditures (Old)

Function

This API can be used to query expenditures 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 can be used to query resource expenditure records generated in the same month.
  • Customers can use this API to query resource expenditures, but enterprise members cannot.
  • This API will be brought offline. For details about the new API for querying resource expenditures, see Viewing Resource Expenditures.
  • You can query data from the past three years.

URI

GET /v1.0/{domain_id}/customer/account-mgr/bill/res-fee-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

Description

startTime

Yes

String

A maximum of 10 characters

Start time. The format is yyyy-MM-dd.

NOTE:

The start time and end time must be in the same month.

endTime

Yes

String

A maximum of 10 characters

End time. The format is yyyy-mm-dd.

NOTE:

The start time and end time must be in the same month.

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.

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 "".

orderId

No

String

A maximum of 64 characters

Order ID.

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 "".

payMethod

Yes

String

A maximum of 4 characters

Payment method. The options are:

0: Yearly/monthly

1: Pay-per-use

offset

No

Integer

[1-Maximum integer]

Page number.

If this parameter is not included in the request parameters, the value 1 is used. It cannot be set to "" or null, and cannot be left empty.

limit

No

Integer

[1-100]

Number of records on each page.

If this parameter is not included in the request parameters, the value 10 is used. It cannot be set to "" or null, and cannot be left empty.

resourceId

No

String

A maximum of 256 characters

Resource ID,

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 "".

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, 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 "".

Request

Request Parameters

None

Example Request

GET https://bss-intl.myhuaweicloud.com/v1.0/{domain_id}/customer/account-mgr/bill/res-fee-records?startTime=2019-08-01&endTime=2019-08-31&payMethod=0&cloudServiceTypeCode=hws.service.type.ebs&regionCode=cn-north-1&orderId=orderId&offset=1&limit=10&resourceId=hws.service.type.ebs&enterpriseProjectId=pjzV4N9Uq1LWMUgh3fYAhJqUbtd6Ad8yALoRJeDoYGl0jWdZoS8UHbcGBqEin1Ia HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

Response

Response Parameters

Parameter

Type

Maximum Length of Characters

Description

error_code

String

A maximum of 16 characters

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

error_msg

String

A maximum of 1024 characters

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

feeRecords

List<ResFeeRecord>

-

Resource usage record.

For details, see Table 3.

totalCount

Integer

-

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

currency

String

A maximum of 3 characters

Currency.

USD

Table 3 ResFeeRecord

Parameter

Type

Maximum Length of Characters

Description

createTime

String

A maximum of 32 characters

Time when a fee record is generated.

effectiveTime

String

A maximum of 32 characters

Start time of using the resource corresponding to the fee. This field is valid only when the resource is billed on a pay-per-use basis. It is reserved for resources billed on a yearly/monthly basis.

expireTime

String

A maximum of 32 characters

End time of using the resource corresponding to the fee. This field is valid only when the resource is billed on a pay-per-use basis. It is reserved for resources billed on a yearly/monthly basis.

feeId

String

A maximum of 64 characters

Fee SN.

productId

String

A maximum of 64 characters

Product ID.

productName

String

A maximum of 256 characters

Product name.

orderId

String

A maximum of 64 characters

Order ID. This field is available only for usage records of yearly/monthly resources. This field is left empty for pay-per-use resources.

amount

Number

-

Consumption amount, including the amount of cash coupons. The value is accurate to two decimal places.

measureId

Integer

-

Unit.

  1. USD
  2. Cent

usageAmount

Number

-

Usage.

usageMeasureId

Integer

-

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

freeResourceAmount

Number

-

Package usage.

freeResourceMeasureId

Integer

-

Unit of the package usage. You can call the API in Querying Measurement Units to obtain the value.

cloudServiceTypeCode

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.

regionCode

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

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.

payMethod

String

A maximum of 32 characters

Payment method. The options are:

0: Yearly/monthly

1: Pay-per-use

projectID

String

A maximum of 64 characters

Project ID.

projectName

String

A maximum of 256 characters

Project name.

resourceTag

String

A maximum of 8,192 characters

Resource tag.

resourceName

String

A maximum of 256 characters

Resource name.

resourceId

String

A maximum of 128 characters

Resource ID.

feeSourceOperation

Integer

-

Order Type

1: Subscription

2: Renewal

3: Change

4: Unsubscription

5: Pay-per-use

6: Discount

7. Special offer

8: Free

9: Huawei write-offs

17: Expenditure - difference amount (min. guaranteed-actual)

19: Change - specifications upgrade

20: Refund - change (entire server)

21: Refund – change (specification downgrade)

enterpriseProjectId

String

A maximum of 128 characters

Enterprise project ID.

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

periodType

String

-

Period type. The value can be:

19: Year

20: Month

24: Day

25: Hour

5: Minute

6: Second

spot

String

A maximum of 64 characters

Spot instance ID. 2 indicates that the resource is a spot instance.

rIAmount

Number

-

Reserved instance usage.

rIMeasureId

Integer

-

Unit (reserved instance usage).

officialAmount

Number

-

Standard price.

Example Response

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

{
	"totalCount": 1,
	"currency": "USD",
	"feeRecords": [{
		"createTime": null,
		"effectiveTime": null,
		"expireTime": null,
		"feeId": null,
		"productId": null,
		"productName": null,
		"orderId": "orderId",
		"amount": null,
		"measureId": 0,
		"usageAmount": null,
		"usageMeasureId": 0,
		"freeResourceAmount": null,
		"freeResourceMeasureId": 0,
		"cloudServiceTypeCode": "hws.service.type.ebs",
		"regionCode": "cn-north-1",
		"resourceTypeCode": null,
		"payMethod": "0",
		"projectID": "04f480425980d32a2f04c018d3326097",
		"projectName": null,
		"resourcetag": null,
		"resourceName": null,
		"resourceId": null,
		"feeSourceOperation": 0,
		"periodType": null,
		"enterpriseProjectId": "pjzV4N9Uq1LWMUgh3fYAhJqUbtd6Ad8yALoRJeDoYGl0jWdZoS8UHbcGBqEin1Ia",
		"spot": null,
		"rIAmount": null,
		"rIMeasureId": 0,
                "officialAmount": 10
	}]
}

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.