更新时间:2025-08-18 15:49:47
统计API接口有以下功能:
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 到 endTime,且时间间隔不能超过一周。格式:YYYYMMDDhhmmss | 是 |
| endTime | 统计的结束时间。格式: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类型:String |
| Bucket | 空间名称。子节点:无父节点:StatisticsResult类型:String |
| Type | 统计类型。子节点:无父节点:StatisticsResult类型:String (requests/bandwidth/ObjectNum) |
| Operation | 请求方法。子节点:无父节点:StatisticsResult类型:String (PUT/POST)查询对象数时,该字段为空 |
| StartTime | 统计的起始时间。子节点:无父节点:StatisticsResult类型:String(格式:YYYYMMDDhhmm) |
| EndTime | 统计的结束时间。子节点:无父节点:StatisticsResult类型:String(格式:YYYYMMDDhhmm) |
| Results | 统计数据的结果。子节点:无父节点:StatisticsResult类型:String |
| 场景 | HTTP状态码 | 错误码 | 消息 |
|---|---|---|---|
| 请求缺少必选参数 | 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 |
| 一分钟内重复发送同一请求 | 429 Too Many Requests | TooManyRequests | You have sent too many requests in a given amount of time. |