GetBucket

Last update:2025-08-18 15:50:06

To list the objects in a specified bucket, the permission of IAM wos:GetBucket is required

Request syntax

GET /?prefix=Prefix&marker=Marker&max-keys=Max-Keys&delimiter=Delimiter&start-time=Start-Time&end-time=End-Time
Host: BucketName.Endpoint
Date: Date
Authorization: <Authorization>

Request parameters

Parameter Name Required Description Type
prefix No Returns objects that begin with the specified prefix. You can use the prefix to group objects, similar to folders in a file system. String
marker No Specifies the key to start with when listing objects, sorted in lexicographical order. String
max-keys No The maximum number of objects to return. The list will contain up to max-keys objects in lexicographical order, ranging from [1, 1000]. If out of range, the default value 1000 is used. Integer
delimiter No A character used to group object names. If the prefix parameter is specified, all object names are split using the delimiter, and objects with the same string between the prefix and the first delimiter form a CommonPrefixes entry. If the prefix parameter is not specified, the objects are grouped based on the same name segment before the first delimiter. String

Note: Parameter names are case-sensitive. For example, setting PREFIX=abc will not take effect, even though it will be included in authorization.

Request header

Only use common request headers .

Request body

no

Response syntax

HTTP/1.1 StatusCode
x-wos-request-id: RequestId
Date: Date
Content-Type: type
Content-Length: length
Server: WS-web-server

<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="https://www.wangsu.com/document">
  <IsTruncated>boolean</IsTruncated>
  <Marker>string</Marker>
  <NextMarker>string</NextMarker>
  <Contents>
    <ETag>string</ETag>
    <Key>string</Key>
    <LastModified>timestamp</LastModified>
    <ExpirationDate>timestamp</ExpirationDate>
    <Owner>
      <DisplayName>string</DisplayName>
      <ID>string</ID>
    </Owner>
    <Size>integer</Size>
    <StorageClass>string</StorageClass>
  </Contents>
  ...
  <Name>string</Name>
  <Prefix>string</Prefix>
  <Delimiter>string</Delimiter>
  <MaxKeys>integer</MaxKeys>
  <CommonPrefixes>
    <Prefix>string</Prefix>
  </CommonPrefixes>
  ...
  <EncodingType>string</EncodingType>
</ListBucketResult>


Response header

Only use common response headers .

Response Body

The response is returned in XML format and lists the user’s buckets. The meaning of each element is as follows:

Element Name Description Type Parent Node
ListBucketResult List of objects in the bucket. XML -
Contents Metadata of the object. XML ListBucketResult
CommonPrefixes Groups of objects under the specified delimiter. Objects with the same prefix before the delimiter are grouped together. XML ListBucketResult
Delimiter The delimiter used in the request. String ListBucketResult
ETag The base64-encoded 128-bit MD5 digest of the object, serving as a unique identifier for the object’s content. This value can be used to determine if the object’s content has changed. For example, if an uploaded object’s ETag = A and the downloaded object’s ETag = B, the object has changed.
The ETag is the hash of the object. Note that ETag only reflects content changes, not metadata changes. Each uploaded or copied object has a unique ETag after MD5 encryption.
String ListBucketResult.Contents
ID The user ID of the object owner. String ListBucketResult.Contents.Owner
DisplayName The username of the object owner. String ListBucketResult.Contents.Owner
IsTruncated Indicates whether the results are truncated. true means not all results were returned; false means all results were returned. Boolean ListBucketResult
Key Object name. String ListBucketResult.Contents
LastModified Last modified time of the object. Date ListBucketResult.Contents
Marker Start position for listing objects. String ListBucketResult
NextMarker If not all results are returned in this request, this marks the last object returned, and can be used as the Marker for subsequent requests to list the remaining objects. String ListBucketResult
MaxKeys Maximum number of objects to return. String ListBucketResult
Name Bucket name. String ListBucketResult
Owner User information, including user ID and username. XML ListBucketResult.Contents
Prefix Object name prefix. Only objects matching this prefix are listed. String ListBucketResult
Size Object size. String ListBucketResult.Contents
StorageClass Storage type of the object. Valid value: STANDARD Enumeration ListBucketResult.Contents
ExpirationDate Object expiration time. Date ListBucketResult.Contents

Error Scenarios

Situation HTTP Status Error Code Message
max-keys is negative 400 Bad Request InvalidArgument max-keys cannot be negative
max-keys is a decimal or out of integer range 400 Bad Request InvalidArgument Provided max-keys not an integer or within integer range
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!