Queries the storage usage of a specific bucket and the number of objects in the bucket.
Usage notes
To call the GetBucketStat operation, you must have the
oss:GetBucketStat
permission.Data obtained by calling this operation is not real-time data and may have a latency of over an hour.
The time obtained by calling this operation may not be up-to-date. For example, the value of LastModifiedTime obtained by the current GetBucketStat request may be earlier than the value of this LastModifiedTime obtained by the previous GetBucketStat request.
Request syntax
GET /?stat HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
Request headers
All headers in a DescribeRegions request are common request headers. For more information, see Common request headers.
Response headers
All headers in the response to a DescribeRegions request are common response headers. For more information, see Common response headers.
Response elements
Element | Type | Example | Description |
BucketStat | Container | N/A | The container that stores all information returned for the GetBucketStat request. |
Storage | Positive integer | 1600 | The storage usage of the bucket. Unit: bytes. Parent nodes: BucketStat Child nodes: none |
ObjectCount | Positive integer | 230 | The total number of objects in the bucket. Parent nodes: BucketStat Child nodes: none |
MultipartUploadCount | Positive integer | 40 | The number of multipart upload tasks that have been initiated but are not completed or canceled. Parent nodes: BucketStat Child nodes: none |
LiveChannelCount | Positive integer | 4 | The number of LiveChannels in the bucket. Parent nodes: BucketStat Child nodes: none |
LastModifiedTime | Positive integer | 1643341269 | The time when the obtained information was last modified. The value of this parameter is a UNIX timestamp. Unit: seconds. Parent nodes: BucketStat Child nodes: none |
StandardStorage | Positive integer | 430 | The storage usage of Standard objects in the bucket. Unit: bytes. Parent nodes: BucketStat Child nodes: none |
StandardObjectCount | Positive integer | 66 | The number of Standard objects in the bucket. Parent nodes: BucketStat Child nodes: none |
InfrequentAccessStorage | Positive integer | 2359296 | The billed storage usage of Infrequent Access (IA) objects in the bucket. Unit: bytes. Important IA objects that are smaller than 64 KB in size are billed as 64 KB. For more information, see Storage fees. Parent nodes: BucketStat Child nodes: none |
InfrequentAccessRealStorage | Positive integer | 360 | The actual storage usage of IA objects in the bucket. Unit: bytes. Parent nodes: BucketStat Child nodes: none |
InfrequentAccessObjectCount | Positive integer | 54 | The number of IA objects in the bucket. Parent nodes: BucketStat Child nodes: none |
ArchiveStorage | Positive integer | 2949120 | The billed storage usage of Archive objects in the bucket. Unit: bytes. Important Archive objects that are smaller than 64 KB in size are billed as 64 KB. For more information, see Storage fees. Parent nodes: BucketStat Child nodes: none |
ArchiveRealStorage | Positive integer | 450 | The actual storage usage of Archive objects in the bucket. Unit: bytes. Parent nodes: BucketStat Child nodes: none |
ArchiveObjectCount | Positive integer | 74 | The number of Archive objects in the bucket. Parent nodes: BucketStat Child nodes: none |
ColdArchiveStorage | Positive integer | 2359296 | The billed storage usage of Cold Archive objects in the bucket. Unit: bytes. Important Cold Archive objects that are smaller than 64 KB in size are billed as 64 KB. For more information, see Storage fees. Parent nodes: BucketStat Child nodes: none |
ColdArchiveRealStorage | Positive integer | 360 | The actual storage usage of Cold Archive objects in the bucket. Unit: bytes. Parent nodes: BucketStat Child nodes: none |
ColdArchiveObjectCount | Positive integer | 36 | The number of Cold Archive objects in the bucket. Parent nodes: BucketStat Child nodes: none |
DeepColdArchiveStorage | Positive integer | 2359296 | The billed storage usage of Deep Cold Archive objects in the bucket. Unit: bytes. Important Deep Cold Archive objects that are smaller than 64 KB in size are billed as 64 KB. For more information, see Storage fees. Parent nodes: BucketStat Child nodes: none |
DeepColdArchiveRealStorage | Positive integer | 360 | The actual storage usage of Deep Cold Archive objects in the bucket. Unit: bytes. Parent nodes: BucketStat Child nodes: none |
DeepColdArchiveObjectCount | Positive integer | 36 | The number of Deep Cold Archive objects in the bucket. Unit: bytes. Parent nodes: BucketStat Child nodes: none |
Examples
Sample requests
GET /?stat HTTP/1.1 Host: examplebucket.oss-cn-hangzhou.aliyuncs.com Date: Tue, 28 Dec 2021 01:17:29 GMT Authorization: OSS qn6q**************:77Dv****************
Sample success responses
<?xml version="1.0" encoding="UTF-8"?> <BucketStat> <Storage>1600</Storage> <ObjectCount>230</ObjectCount> <MultipartUploadCount>40</MultipartUploadCount> <LiveChannelCount>4</LiveChannelCount> <LastModifiedTime>1643341269</LastModifiedTime> <StandardStorage>430</StandardStorage> <StandardObjectCount>66</StandardObjectCount> <InfrequentAccessStorage>2359296</InfrequentAccessStorage> <InfrequentAccessRealStorage>360</InfrequentAccessRealStorage> <InfrequentAccessObjectCount>54</InfrequentAccessObjectCount> <ArchiveStorage>2949120</ArchiveStorage> <ArchiveRealStorage>450</ArchiveRealStorage> <ArchiveObjectCount>74</ArchiveObjectCount> <ColdArchiveStorage>2359296</ColdArchiveStorage> <ColdArchiveRealStorage>360</ColdArchiveRealStorage> <ColdArchiveObjectCount>36</ColdArchiveObjectCount> </BucketStat>
OSS SDKs
You can use OSS SDKs for the following programming languages to call GetBucketStat:
Error code
Error code | HTTP status code | Description |
AccessDenied | 403 | The error message returned because you are not authorized to query the storage usage of the bucket. Only the owner of the bucket can query the storage usage. |