更新时间:2023-03-31 GMT+08:00
分享

查询资源详单(旧)

功能介绍

客户在自建平台查询自己的资源详单,用于反映各类资源的消耗情况。

注意事项:

  • 该接口只允许使用客户AK/SK或者Token调用。
  • 由于资源消费呈现的是资源维度的8位小数原始消费金额,实际从账户扣费时按2位小数进行扣费(即扣到分),会存在精度差异,所以,不推荐消费汇总和资源消费直接对账。

    该接口即将下线,“查询资源详单”接口请参考查询资源详单

URI

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

URL参数说明请参见下表。

表1 路径参数

参数

是否必选

取值范围

描述

domain_id

最大长度:64

客户账号ID。获取方法请参见如何获取客户的customer_id/domain_id

表2 查询参数

参数

是否必选

参数类型

取值范围

描述

cycle

String

最大长度:8

消费月份,格式为YYYY-MM。

例如2020-01。

cloudServiceTypeCode

String

最大长度:256

云服务类型编码,例如OBS的云服务类型编码为“hws.service.type.obs”。您可以调用查询云服务类型列表接口获取。

此参数不携带或携带值为空,不作为筛选条件;携带值为null时,作为筛选条件;不支持携带值为空串。

resourceTypeCode

String

最大长度:256

资源类型编码,例如ECS的VM为“hws.resource.type.vm”。您可以调用查询资源类型列表接口获取。

此参数不携带或携带值为空,不作为筛选条件;携带值为null时,作为筛选条件;不支持携带值为空串。

regionCode

String

最大长度:64

云服务区编码,例如:“cn-north-1”。具体请参见地区和终端节点对应云服务的“区域”列的值。

此参数不携带或携带值为空,不作为筛选条件;携带值为null时,作为筛选条件;不支持携带值为空串。

resInstanceId

String

最大长度:256

资源实例ID。

此参数不携带或携带值为空,不作为筛选条件;携带值为null时,作为筛选条件;不支持携带值为空串。

payMethod

String

最大长度:4

支付方式:

  • 0:包年/包月
  • 1:按需
  • 10:预留实例

enterpriseProjectId

String

最大长度:64

企业项目ID。

此参数不携带或携带值为空,不作为筛选条件;携带值为null时,作为筛选条件;不支持携带值为空串。

offset

Integer

[1-最大整数]

页码。

limit

Integer

[1-1000]

页面大小。

请求消息

请求参数

无。

请求示例

GET https://bss.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-TokenMIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

响应消息

响应参数

参数

参数类型

取值范围

描述

error_code

String

最大长度:16

状态码。具体请参考状态码。只有失败才会返回这个参数。

error_msg

String

最大长度:1024

错误描述信息。只有失败才会返回这个参数。

monthlyRecords

List<MonthlyRecord>

N/A

资源费用记录数据。

具体请参见表3

totalCount

Int

N/A

结果集数量,只有成功才返回这个参数。

currency

String

最大长度:3

货币单位代码:

CNY:人民币

表3 MonthlyRecord

参数

参数类型

取值范围

描述

cloudServiceTypeCode

String

最大长度:256

云服务类型编码,例如OBS的云服务类型编码为“hws.service.type.obs”。您可以调用查询云服务类型列表接口获取。

regionCode

String

最大长度:64

云服务区编码,例如:“cn-north-1”。具体请参见地区和终端节点对应云服务的“区域”列的值。

resourceTypeCode

String

最大长度:256

资源类型编码,例如ECS的VM为“hws.resource.type.vm”。您可以调用查询资源类型列表接口获取。

resInstanceId

String

最大长度:256

资源实例ID。

resourceName

String

-

资源名称。客户在创建资源的时候,可以输入资源名称,有些资源也可以在管理资源时,修改资源名称。

resourceTag

String

-

资源标签。客户在管理资源的时候,可以设置资源标签。

consumeAmount

Number

-

客户购买云服务类型的消费金额,包含代金券、现金券,精确到小数点后8位。

cycle

String

-

消费月份。

measureId

Integer

[1-3]

金额单位:

1:元;

2:角;

3:分。

enterpriseProjectId

String

-

企业项目ID。

payMethod

String

[0-1]

计费方式:

0:包年/包月;

1:按需。

officialAmount

Number

-

官网价。

响应示例

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": "0026e1c479284125824f1b461eb25aae",
			"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": "00560a07f8ac4194b709f87a8fce1b8c",
			"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": "06c2cc39b7c342f4bc39b4cb57b1088a",
			"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": "083b13ad47c64418a6d7ae32030a2323",
			"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": "0fab6e80b80e48a7b3e52b45dfe2321e",
			"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": "0ffd1902971240d783d06ce369d5504d",
			"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": "1b92b455dc3645c3b3b031edd8f8e8c2",
			"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": "1e4e3cffa9c440d2b9ed20b9e4d246a1",
			"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": "2957abd367994ffeac91c7d7480448a1",
			"resourceName": null,
			"resourceTag": null,
			"consumeAmount": 10000,
			"cycle": "2019-06",
			"measureId": 3,
			"enterpriseProjectId": "0",
			"payMethod": "0",
                        "officialAmount": 10
		}
	],
	"totalCount": 33,
	"currency": "CNY"
}

状态码

  • 状态码4xx:由于明显的客户端错误(例如,格式错误的请求语法、参数错误等),华为云会返回4xx错误码,请及时检查请求消息的正确性,重新发起请求。
  • 状态码5xx:由于华为云系统原因,导致无法完成明显有效请求的处理,可及时联系华为云客服处理。

HTTP状态码

错误码

错误描述

400

CBC.0100

参数错误。

403

CBC.0151

访问拒绝。

500

CBC.0999

未知错误。

分享:

    相关文档

    相关产品