调用QueryAccountBill查询用户某个账期内的消费,并以资源所有者的维度进行汇总。
API描述
在调用该接口时,请注意:
- 账号账单由实例账单汇总,一般存在一天延迟。
- 云通信产品可查询从2020年6月以后的数据,不包含万网产品数据。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | QueryAccountBill | 系统规定参数。取值:QueryAccountBill。 |
| BillingCycle | String | 是 | 2018-07 | 账单日期,YYYY-MM。 |
| PageNum | Integer | 否 | 1 | 页码,默认值为1。 |
| PageSize | Integer | 否 | 20 | 每页数量,默认值20,最大值:300。 |
| IsGroupByProduct | Boolean | 否 | false | 是否增加产品Code汇总。
默认false。 |
| ProductCode | String | 否 | rds | 产品code。 |
| BillOwnerId | Long | 否 | 122 | 子账号ID。设置可查看财务云子账号账单,不填默认查看当前调用账号。 |
| Granularity | String | 否 | Monthly | 查询账单的颗粒度。取值:
选择DAILY需指定BillingDate。 |
| BillingDate | String | 否 | 2021-06-01 | 账单日期,仅当Granularity为DAILY时必填,格式为YYYY-MM-DD。 |
返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Code | String | Success | 状态码。 |
| Message | String | Successful! | 错误信息。 |
| RequestId | String | 3BFC23FE-A182-4D96-A1E4-7521B30B8E43 | 请求ID。 |
| Success | Boolean | true | 是否成功。 |
| Data | Object | 返回数据。 |
|
| PageNum | Integer | 1 | 页码。 |
| BillingCycle | String | 2020-03 | 账期,格式:YYYY-MM。 |
| AccountID | String | 1857xxxxx489 | 账号ID。 |
| PageSize | Integer | 20 | 每页显示条数。 |
| TotalCount | Integer | 1 | 总记录数。 |
| AccountName | String | test@test.aliyunid.com | 账号。 |
| Items | Array of Item | 账单详情。 |
|
| Item | |||
| PipCode | String | rds | 产品Code,与费用中心账单产品Code一致 |
| PretaxAmount | Float | 0 | 应付金额。 |
| BillingDate | String | 2021-03-01 | 账单日期。 |
| ProductName | String | rds | 产品名称。 说明 仅当IsGroupByProduct为true时返回。 |
| AdjustAmount | Float | 0 | 信用额度退款抵扣。 |
| OwnerName | String | aligzncloudtest2 | 子账号名称。 |
| Currency | String | CNY | 币种。取值:
|
| BillAccountName | String | test@test.aliyunid.com | 账单所属账号名称。 |
| SubscriptionType | String | PayAsYouGo | 产品订阅类型:
说明 仅当IsGroupByProduct为true时返回。 |
| DeductedByCashCoupons | Float | 0 | 代金券抵扣。 |
| BizType | String | trusteeship | 业务类型。 |
| OwnerID | String | 325434254 | 子账号的阿里云ID。 |
| DeductedByPrepaidCard | Float | 0 | 储值卡抵扣。 |
| DeductedByCoupons | Float | 0 | 优惠券抵扣。 |
| BillAccountID | String | 1857xxxxx489 | 账单所属账号ID。 |
| PaymentAmount | Float | 0 | 现金支付(含信用额度退款抵扣)。 |
| InvoiceDiscount | Float | 0 | 优惠金额。 |
| OutstandingAmount | Float | 0 | 未结清金额或信用结算金额。 |
| CostUnit | String | 未分配 | 财务单元。 |
| PretaxGrossAmount | Float | 0 | 原始金额。 |
| CashAmount | Float | 0 | 现金支付(不包含信用额度退款抵扣)。 |
| ProductCode | String | rds | 产品code。 说明 仅当IsGroupByProduct为true时返回。 |
示例
请求示例
http(s)://[Endpoint]/?Action=QueryAccountBill
&<公共请求参数>
正常返回示例
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<RequestId>3BFC23FE-A182-4D96-A1E4-7521B30B8E43</RequestId>
<Message>Successful!</Message>
<Data>
<TotalCount>1</TotalCount>
<BillingCycle>2020-03</BillingCycle>
<AccountID>1857xxxxx489</AccountID>
<PageSize>20</PageSize>
<PageNum>1</PageNum>
<AccountName>test@test.aliyunid.com</AccountName>
<Items>
<Item>
<DeductedByCoupons>0</DeductedByCoupons>
<OwnerName>aligzncloudtest2</OwnerName>
<ProductName>rds</ProductName>
<ProductCode>rds</ProductCode>
<BillAccountID>1857xxxxx489</BillAccountID>
<OutstandingAmount>0</OutstandingAmount>
<DeductedByCashCoupons>0</DeductedByCashCoupons>
<BizType>trusteeship</BizType>
<BillingDate>2021-03-01</BillingDate>
<PaymentAmount>0</PaymentAmount>
<DeductedByPrepaidCard>0</DeductedByPrepaidCard>
<PipCode>rds</PipCode>
<InvoiceDiscount>0</InvoiceDiscount>
<SubscriptionType>PayAsYouGo</SubscriptionType>
<PretaxGrossAmount>0</PretaxGrossAmount>
<OwnerID>325434254</OwnerID>
<PretaxAmount>0</PretaxAmount>
<Currency>CNY</Currency>
<BillAccountName>test@test.aliyunid.com</BillAccountName>
<CostUnit>未分配</CostUnit>
<CashAmount>0</CashAmount>
<AdjustAmount>0</AdjustAmount>
</Item>
</Items>
</Data>
<Code>Success</Code>
<Success>true</Success>
JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "3BFC23FE-A182-4D96-A1E4-7521B30B8E43",
"Message" : "Successful!",
"Data" : {
"TotalCount" : 1,
"BillingCycle" : "2020-03",
"AccountID" : "1857xxxxx489",
"PageSize" : 20,
"PageNum" : 1,
"AccountName" : "test@test.aliyunid.com",
"Items" : {
"Item" : {
"DeductedByCoupons" : 0,
"OwnerName" : "aligzncloudtest2",
"ProductName" : "rds",
"ProductCode" : "rds",
"BillAccountID" : "1857xxxxx489",
"OutstandingAmount" : 0,
"DeductedByCashCoupons" : 0,
"BizType" : "trusteeship",
"BillingDate" : "2021-03-01",
"PaymentAmount" : 0,
"DeductedByPrepaidCard" : 0,
"PipCode" : "rds",
"InvoiceDiscount" : 0,
"SubscriptionType" : "PayAsYouGo",
"PretaxGrossAmount" : 0,
"OwnerID" : 325434254,
"PretaxAmount" : 0,
"Currency" : "CNY",
"BillAccountName" : "test@test.aliyunid.com",
"CostUnit" : "未分配",
"CashAmount" : 0,
"AdjustAmount" : 0
}
}
},
"Code" : "Success",
"Success" : true
}
错误码
访问错误中心查看更多错误码。