GetConsumptionsByQuery【查询消费记录列表】¶
查询消费记录列表:可根据时间段、资源类型来获取消费信息列表。 如果不指定任何过滤条件,默认返回已消费的信息。 如果指定非法的资源类型值,则会返回空的信息列表。
Request Parameters
Parameter name | Type | Description | Required |
---|---|---|---|
action | String | API 标识符 | Yes |
region | String | 区域、节点 | No |
type | String | 资源类型,有效值router,bandwidth,instance,volume,image,floatingip,loadbalance,cdn router:路由器
bandwidth:总带宽
instance:云主机
volume:云硬盘
image:镜像
floatingip:公网 IP
loadbalance:负载均衡
cdn:CDN
|
No |
start_at | String | 开始时间 | No |
end_at | String | 结束时间 | No |
Response Elements
Name | Type | Description |
---|---|---|
message | String | 执行结果信息 |
code | Integer | HTTP Resonpe响应状态码 |
data | Array | JSON 格式的消费信息列表,每项参数可见下面 Data Item |
Data Item
Name | Type | Description |
---|---|---|
res_type | String | 资源类型 |
res_meta | Dict | 资源配置 |
start_at | String | 开始时间 |
name | String | 资源名称 |
region | String | 地区位置 |
unit_price | String | 单价 |
end_at | String | 结束时间 |
billing_type | String | 计费类型 |
amount | String | 总额 |
remarks | String | 备注 |
billing_id | String | 消费记录 ID |
cost_time | String | 计费时长 |
res_id | String | 资源ID |
id | String | 随机 UUID |
is_billing | Booleam | 是否计费 |
Example
Example Request:
Request Headers:
POST /api/ HTTP/1.1
Origin: https://console.plcloud.com
X-CSRFToken: 6An6xEuOJqW6dVDtlgzZr6FqgkSbJmqp
Content-Type: application/x-www-form-urlencoded
Form Data:
action: GetConsumptionsByQuery
region:
type:instance
start_at:2014-12-01
end_at:2014-12-02
Example Response:
{
"message": "成功",
"code": 200,
"data": [
{
"res_type": "instance",
"res_meta": {
"memory_gb": 2,
"ephemeral_gb": 0,
"vcpus": 1,
"disk_gb": 0
},
"start_at": "2014-12-01 00:00:00",
"name": "joelei1",
"region": "shenzhen",
"unit_price": "0.152748",
"end_at": "2014-12-02 00:00:00",
"billing_type": "hour",
"amount": "3.6659520000",
"remarks": "资源更新",
"billing_id": "c9ee5686-4066-4a65-a632-ad9b12a71881",
"cost_time": "24.0000",
"res_id": "ced51e4a-e659-4641-a859-64f5d38e576d",
"id": "f5b4d92d-3486-46b6-bf4b-1888d1eca706",
"is_billing": false,
"region_name": ""
}
],
"total_amount": "3.6659520000"
}