更新时间:2023-08-17 17:36:36
功能描述
1)获取分钟级时间间隔内请求成功的put/post请求数;
2)获取分钟级时间间隔内成功上传的带宽。
3)获取每小时的存储量和对象数
4)请求参数通过URL传递。
GET /bucketname?statistics&type=requests&method=PUT&startTime=201707200244 HTTP/1.1
Host: Bucket.Endpoint
Date: Date
Authorization: Authorization
该接口请求消息参数如下:
参数名 | 描述 | 是否必填 |
type | 定义查询的统计数据项 可选值:requests(请求数),bandwidth(带宽),ObjectNum(对象数) | 是 |
startTime | 定义查询的开始时间,精确到分钟。 如果endTime没有定义,则响应的是starttime当前这个周期的,否则响应的是startTime到endTime这段时间的统计数据,时间间隔不能超过一周 类型:YYYYMMDDhhmmss | 是 |
endTime | 定义查询的结束时间。如果没有定义,则响应starttime当前这个周期的. 类型:YYYYMMDDhhmmss | 否 |
method | 定义监控数据的请求方法,查询对象数时,该参数不生效。 可选值:PUT/POST | 是 |
使用公共请求头部。
此接口请求消息中不使用请求消息元素。
HTTP/1 status_code
x-amz-request-id: request id
Date: date
Content-Type: type
Content-Length: length
<?xml version=”0” encoding=”UTF-8” standalone=”yes”?>
<StatisticsResult xmlns=” http://wcs.chinanetcenter.com/document”>
<Owner>Owner<Owner>
<Bucket>Bucket</Bucket>
<Type>Type</Type>
<Operation >Operation </Operation >
<StartTime>StartTime</StartTime>
<EndTime>EndTime</EndTime>
<Results time="2017-07-23 02:44">2472</Results>
<Results time="2017-07-23 02:45">2546</Results>
……
</StatisticsResult>
使用公共响应头部。
此请求的响应通过消息元素返回结果,元素的具体意义如下表所示。
字段名称 | 描述 |
StatisticsResult | 查询接口响应信息根节点 子节点:Owner,Bucket,Type,StartTime,EndTime,Results 类型:XML 父节点:空 |
Owner | 空间所有者 子节点:空 父节点:StatisticsResult 类型:字符串 |
Bucket | 空间名 子节点:空 父节点:StatisticsResult 类型:字符串 |
Type | 查询数据类型 子节点:空 父节点:StatisticsResult 类型:字符串(requests/bandwidth/ObjectNum) |
Operation | 查询数据操作类型 子节点:空 父节点:StatisticsResult 类型:字符串(PUT/POST)查询对象数时,该字段为空 |
StartTime | 查询监控数据开始时间 子节点:空 父节点:StatisticsResult 类型:字符串(格式是YYYYMMDDhhmm(年月日时分)) |
EndTime | 查询监控数据结束时间 子节点:空 父节点:StatisticsResult 类型:字符串(格式是YYYYMMDDhhmm(年月日时分)) |
Results | 查询监控数据结果 子节点:空 父节点:StatisticsResult 类型:字符串 |
场景 | http status code | Error code | message |
请求时缺少必填参数 | 400 Bad Request | InvalidArgument | Please provide parameter {parameter name}
|
请求时子资源拼写错误或者没带 | 405 Method Not Allowed | MethodNotAllowed | MethodNotAllowed |
请求中的Method不属于这些方法中的一种GET,HEAD,POST,PATCH,DELETE,OPTIONS,TRACE | 400 Bad Request | InvalidArgument | Method is invalid |
请求时startTime/endTime参数格式非法 | 400 Bad Request | InvalidArgument | {parameter name} is Invalid |
请求中开始时间比当前时间晚 | 400 Bad Request | InvalidArgument | {parameter name} is invalid |
请求中的 开始时间比结束时间晚 | 400 Bad Request | InvalidArgument | The startTIme must be less than endTime |
请求中结束时间比当前时间晚 | 400 Bad Request | InvalidArgument | {parameter name} is invalid |
URL过期 | 403 Forbidden
| RequestTimeTooSkewed | The difference between the request time and the current time is too large. |
请求查询的实际间隔大于一周 | 400 Bad Request | InvalidArgument | The difference between the startTime and endTime must be less than one week. |
请求中type定义不在支持范围(无论单词拼写错误还是带了不支持的查询类型) | 400 Bad Request | InvalidArgument | Parameter Type only support requests and bandwidth |
同样的请求在一分钟内请求次数大于2次 | 429 Too Many Requests
| TooManyRequests | You has sent too many requests in a given amount of time. |