查询用户算力用量
更新时间:2025-08-05
接口描述
本接口用于查询用户的算力用量数据。
请求结构
Plain Text
1GET /v1/usage/computing HTTP/1.1
2Host: bec.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必须 | 参数位置 | 描述 |
---|---|---|---|---|
beginDate | String | 是 | Query参数 | 查询开始日期,格式'2020-10-15' |
endDate | String | 是 | Query参数 | 查询结束日期,格式'2020-10-15',最长时间跨度31天 |
响应头域
除公共头域外,无其它特殊头域。
响应参数
参数名称 | 类型 | 描述 |
---|---|---|
accountId | String | 账户ID |
timeSpan | Map<String,String> | 查询时间,包含beginDate和endDate |
graphData | Map<String, GraphData> | 算力用量数据 |
summary | Map<String, Map<String, BigDecimal>> | 按日期汇总的算力用量数据,为每日平均值 |
错误码
请参照错误返回章节的内容。
请求示例
Plain Text
1GET /v1/usage/computing HTTP/1.1
2Host: bec.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2021-06-08T03:28:09Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4{
5 "beginDate": "2020-11-03",
6 "endDate": "2020-11-25"
7}
响应示例
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3Date: Wed, 08 Jul 2021 03:28:11 GMT
4x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
5Server: BWS
6{
7 "accountId": "accountId",
8 "timeSpan": {
9 "beginDate": "2020-11-03",
10 "endDate": "2020-11-25"
11 },
12 "graphData": {
13 "CPU": {
14 "count": 30,
15 "unit":"核",
16 "dataList": [{
17 "amount": 30.223,
18 "timestamp": 1602845549040
19 },
20 {
21 "amount": 40.213,
22 "timestamp": 1602845549040
23 },
24 {
25 "amount": 50.223,
26 "timestamp": 1602845549040
27 }
28 ]
29 },
30 "EIP": {
31 "count": 30,
32 "unit":"个",
33 "dataList": [{
34 "amount": 30.223,
35 "timestamp": 1602845549040
36 },
37 {
38 "amount": 40.213,
39 "timestamp": 1602845549040
40 },
41 {
42 "amount": 50.223,
43 "timestamp": 1602845549040
44 }
45 ]
46 },
47 "BOS_Standard": {
48 "count": 30,
49 "unit":"GB",
50 "dataList": [{
51 "amount": 30.223343133,
52 "timestamp": 1602845549040
53 },
54 {
55 "amount": 40.223343133,
56 "timestamp": 1602845549040
57 },
58 {
59 "amount": 50.223343133,
60 "timestamp": 1602845549040
61 }
62 ]
63 },
64 …………
65 "Memory": {
66 "count": 30,
67 "unit":"GB",
68 "dataList": [{
69 "amount": 60.234,
70 "timestamp": 1602845549040
71 }]
72 }
73 },
74 "summary": {
75 "2020-11-03": {
76 "CPU": 17.223,
77 "EIP": 34.423,
78 "BOS_Standard":34.342356432,
79 …………
80 "Memory": 334.342
81 },
82 "2020-11-04": {
83 "CPU": 17.223,
84 "EIP": 34.423,
85 "BOS_Standard":34.342356432,
86 …………
87 "Memory": 334.342
88 },
89 …………
90 "2020-11-25": {
91 "CPU": 17.223,
92 "EIP": 34.423,
93 "BOS_Standard":34.342356432,
94 …………
95 "Memory": 334.342
96 }
97 }
98}
Model对象定义
GraphData
参数名称 | 类型 | 描述 |
---|---|---|
count | Integer | 数据点数量 |
unit | String | 算力数据单位 |
dataList | List<DataUnit> | 算力数据 |
DataUnit
参数名称 | 类型 | 描述 |
---|---|---|
amount | BigDecimal | 算力数值 |
timestamp | Long | 数据时间点 |