หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Querying Cost Data

Updated on 2024-12-12 GMT+08:00

Function

This API is used to query the cost data on the self-built platform.

NOTE:
  • Original costs: There is an appropriately one-hour delay before data from Billing Center shows up as original costs for the current month on the platform. To view the exact amounts, see the final bill that will be generated on the 3rd day of the following month. The original costs are available for viewing after 12:00 noon on the 4th day of the following month.
  • Amortized costs: They are not calculated in real time. Your amortized costs are refreshed once every 24 hours, and it may take longer than 24 to 48 hours for some data to be displayed. The current month costs of monthly-settlement cloud services, such as CDN and VPC, are available for viewing after 12:00 noon on the 4th day of the following month.

Note:

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

The data of the previous month is available after the bill is generated.

Debugging

You can debug this API in API Explorer.

URI

POST /v4/costs/cost-analysed-bills/query

Table 1 Header parameters

Parameter

Mandatory

Value Range

Description

X-Language

No

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

time_condition

Yes

TimeCondition Object

-

Time condition. For details, see Table 2.

groupby

Yes

List<GroupBy>

A maximum of 2 values

Search dimension. For details, see Table 3.

NOTE:

If there are two values for this parameter, the values must be a combination of tag, cost_unit, and dimension, or both of these two values are set to dimension.

cost_type

Yes

String

A maximum of 256 characters

Cost type.

  • ORIGINAL_COST: Original cost
  • AMORTIZED_COST: Amortized cost

amount_type

Yes

String

  

Amount type.

  • PAYMENT_AMOUNT
  • NET_AMOUNT.

filters

No

List<Filter>

Minimum length: 0 characters

Maximum length: 100 characters

Filter. For details, see Table 4.

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

offset

No

Integer

[0-200000]

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

NOTE:

This parameter is used for pagination. Use the default value 0 if pagination is not required. offset indicates the offset relative to the first data record that meets the conditions. If you set offset to 1, the second and subsequent data records will be returned.

For example, there are 10 data records, and if you set limit to 10 and offset to 1, the second to the tenth data records will be returned.

limit

No

Integer

[1,1000]

Number of records queried each time. The default value is 10.

Table 2 TimeCondition

Parameter

Mandatory

Type

Value Range

Description

time_measure_id

Yes

Integer

[1,2]

Time unit.

  • 1: Day
  • 2: Month

begin_time

Yes

String

32

Start date (GMT+08:00).

  • If the value for time_measure_id is 1, the date is in YYYY-MM-DD format.
  • If the value for time_measure_id is 2, the date is in YYYY-MM format.

end_time

Yes

String

32

End date (GMT+08:00).

  • If the value for time_measure_id is 1, the date is in YYYY-MM-DD format.
  • If the value for time_measure_id is 2, the date is in YYYY-MM format.
NOTICE:

Only the cost data within 18 months can be queried.

Table 3 GroupBy

Parameter

Mandatory

Type

Value Range

Description

type

Yes

String

A maximum of 64 characters

  • tag: Grouped by cost tags
  • cost_unit: Grouped by cost categories
  • dimension: Default value

key

Yes

String

A maximum of 128 characters

  • If type is set to tag, the value for this parameter is the key of the tag.
  • If type is set to cost_unit, set this parameter to the key of cost_unit.
  • If type is set to dimension, the value options are as follows:
    • CLOUD_SERVICE_TYPE: Service type
    • ASSOCIATED_ACCOUNT: Linked account
      NOTE:

      An enterprise master account that has the permission to view the expenditure data of its associated member accounts can view the cost data of the member accounts.

    • REGION_CODE: Region
    • RES_SPEC_CODE: Specification code
    • USAGE_TYPE: Usage type
    • ENTERPRISE_PROJECT_ID: Enterprise project
    • RESOURCE_ID: Resource
    • CHARGING_MODE: Billing mode
    • BILL_TYPE: bill type
    • RESOURCE_TYPE: Resource type
    • AZ_CODE: AZ
    • BE_ID: Business entity
    • PAYER_ACCOUNT_ID: Payer account
    • SPLIT_ITEM_NAME: split item
Table 4 Filter

Parameter

Mandatory

Type

Value Range

Description

operator

Yes

Integer

[0-1]

Operator.

  • 0: Only contains
  • 1: Only excludes

filter_factor

Yes

FilterFactor Object

-

Filter factor. For details, see Table 5.

Table 5 FilterFactor

Parameter

Mandatory

Type

Value Range

Description

key

Yes

String

A maximum of 256 characters

Grouping conditions.

  • CLOUD_SERVICE_TYPE: Service type
  • ASSOCIATED_ACCOUNT: Linked account
    NOTE:

    Set this parameter to the HUAWEI ID of the associated account.

    An enterprise master account that has the permission to view the expenditure data of its associated member accounts can view the cost data of the member accounts.

  • REGION_CODE: Region
  • RES_SPEC_CODE: Specification code
  • USAGE_TYPE: Usage type
  • ENTERPRISE_PROJECT_ID: Enterprise project
  • RESOURCE_ID: Resource
  • CHARGING_MODE: Billing mode
  • BILL_TYPE: bill type.
  • RESOURCE_TYPE: Resource type
  • AZ_CODE: AZ
  • BE_ID: Business entity
  • PAYER_ACCOUNT_ID: Payer account
  • RESOURCE_TAG: Cost tag
  • COST_UNIT: Cost category
  • SPLIT_ITEM_NAME: split item
    NOTE:

    When the cost type is ORIGINAL_COST, split items cannot be used to query costs.

value

Yes

List<String>

Minimum count: 1

Maximum count: 100

Filter value.

Example Request

POST https://bss-intl.myhuaweicloud.com/v4/costs/cost-analysed-bills/query HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ
{
	"amount_type": "PAYMENT_AMOUNT",
	"offset": 0,
	"cost_type": "ORIGINAL_COST",
	"limit": 10,
	"groupby": [{
		"type": "dimension",
		"key": "CLOUD_SERVICE_TYPE"
	}],
	"filters": [{
		"filter_factor": {
			"value": ["cn-north-1"],
			"key": "REGION_CODE"
		},
		"operator": 0
	}],
	"time_condition": {
		"end_time": "2021-07-15",
		"begin_time": "2021-07-14",
		"time_measure_id": 1
	}
}

Response Message

Response Parameters

Parameter

Type

Value Range

Description

error_code

String

A maximum of 20 characters

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

error_msg

String

A maximum of 1000 characters

Error description. This parameter is returned only when the query failed.

currency

String

A maximum of 8 characters

Currency.

  • USD

total_count

Integer

-

Total number of records.

cost_data

List<CostDataByDimension>

-

Cost details by day or month. For details, see Table 6.

Table 6 CostDataByDimension

Parameter

Type

Value Range

Description

dimensions

List<DimensionGroup>

A maximum of 1 value

Dimensions. For details, see Table 7.

costs

List<Cost>

Max Count: 10000

Cost value. For details, see Table 8.

amount_by_costs

String

A maximum of 64 characters

Total cost in a period.

official_amount_by_costs

String

A maximum of 64 characters

Total expenditures based on list prices in a period.

Table 7 DimensionGroup

Parameter

Type

Value Range

Description

key

String

A maximum of 128 characters

Grouping conditions

  • CLOUD_SERVICE_TYPE: Service type
  • ENTERPRISE_PROJECT_ID: Enterprise project
  • USAGE_TYPE: Usage type
  • RESOURCE_TYPE: Resource type
  • AZ_CODE: AZ
  • BILL_TYPE: Bill type
  • ASSOCIATED_ACCOUNT: Linked account
  • RES_SPEC_CODE: Specification Code
  • BE_ID: Business entity
  • REGION_CODE: Region
  • CHARGING_MODE: Billing mode
  • PAYER_ACCOUNT_ID: Payer account
  • RESOURCE_TAG: Resource tag
  • RESOURCE_ID: Resource ID
  • COST_UNIT: Cost category
  • SPLIT_ITEM_NAME: Split item

value

String

-

Dimension.

Table 8 Cost

Parameter

Type

Value Range

Description

time_dimension_value

String

A maximum of 20 characters

Time dimension.

  • yyyy-mm-dd indicates that data is filtered by day.
  • yyyy-mm indicates that data is filtered by month.

time_measure_id

Int

-

Time unit.

  • 1: Day
  • 2: Month

amount

String

A maximum of 64 characters

One of the following cost types: original costs, net original costs, amortized costs, and net amortized costs.

official_amount

String

A maximum of 64 characters

List price.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time 
{
    "currency": "USD",
    "total_count": 1,
    "cost_data": [
        {
            "dimensions": [
                {
                    "key": "tag",
                    "value": "Group:noTagKey"
                }
            ],
            "costs": [
                {
                    "time_dimension_value": "2021-08",
                    "time_measure_id": 2,
                    "amount": "13225.00",
                    "official_amount": "13225.00"
                }
            ],
            "amount_by_costs": "13225.00",
            "official_amount_by_costs": "13225.00"
        }
    ]
}

Returned Values

NOTE:
  • 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 Value

Error Code

Description

400

CBC.0100

Invalid parameter.

400

CBC.18000014

Cost Center not enabled.

400

CBC.18000016

Insufficient permissions. Contact your partner.

400

CBC.18000053

Insufficient permissions. Contact your enterprise master.

500

CBC.0999

Other errors.

400

CBC.18000048

Too many independent accounting members. Specify a member account for query.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback