Updated on 2026-07-27 GMT+08:00

Listing Objects in a Bucket

Function

This API lists objects in a bucket. If you only specify the bucket name in the request, OBS returns descriptions for some or all of the objects (up to 1,000) in the bucket. If you also specify one or more of the prefix, marker, max-keys, and delimiter parameters, OBS returns a list of objects based on the semantics specified in Table 1.

For more information about listing objects in a bucket, see Listing Objects.

Constraints

  • Listing objects by specifying a page number is not allowed.
  • Objects cannot be listed by time when they were uploaded. You can search for objects by prefix.
  • The size and last modification time in the object list sort only objects on the current page.

Authorization

To call this API, you must be the bucket owner or have the permissions to list objects in a bucket. You are advised to use IAM or bucket policies for authorization. For details about OBS authorization methods, see Differences Between OBS Permissions Control Methods.

  • If you use IAM for authorization, you need to use either role/policy-based authorization or identity policy-based authorization and configure the required permissions:
    • If you use role/policy-based authorization (IAM v3 APIs in the old IAM version), you must have the obs:bucket:ListBucket (versioning disabled) and obs:bucket:ListBucketVersions (versioning enabled or suspended) permissions. For details, see Creating a Custom IAM Policy.
    • If you use identity policy-based authorization (IAM v5 APIs in the new IAM version), you must have the obs:bucket:listBucket (versioning disabled) and obs:bucket:listBucketVersions (versioning enabled or suspended) permissions, as shown in the following table. For details, see Creating a Custom IAM Identity Policy.

      Action

      Access Level

      Resource Type (*: Required)

      Condition Key

      Alias

      Dependencies

      obs:bucket:listBucket (versioning disabled)

      obs:bucket:listBucketVersions (versioning enabled or suspended)

      List

      bucket *

      -

      -

      -

      • obs:EpochTime
      • obs:SourceIp
      • obs:TlsVersion
      • obs:CustomDomain
      • obs:prefix
      • obs:delimiter
      • obs:max-keys
  • If you use bucket policies for authorization, you must have the obs:bucket:ListBucket (versioning disabled) and obs:bucket:ListBucketVersions (versioning enabled or suspended) permissions. For details, see Creating a Custom Bucket Policy.

URI

GET /

Calling Method

For details, see Calling APIs. Before calling this API, calculate the API signature and add it to the request.

You can debug this API in API Explorer.

Request Syntax

The following is an example request. Replace BucketName with your bucket name and RegionID with the ID of the region where your bucket resides. You can obtain the region ID by referring to Supported Regions.

Request syntax when versioning is disabled:

GET / HTTP/1.1 
Host: BucketName.obs.RegionID.myhuaweicloud.com 
Date: GMT Date
Authorization: SignatureValue

Request syntax when versioning is enabled or suspended:

GET /?versions HTTP/1.1  
Host: BucketName.obs.RegionID.myhuaweicloud.com 
Date: GMT Date
Authorization: SignatureValue

URI Parameters

This API uses URI parameters to list some objects in a bucket. Table 1 describes the parameters.

Table 1 URI parameters

Parameter

Type

Mandatory

Description

prefix

String

No

Definition

Name prefix that the objects to be listed must contain.

Constraints

The value must comply with the format of the object name.

Range

1 to 1,024 characters

Default Value

N/A

marker

String

No

Definition

Name of the object to start with when listing objects in a bucket. All objects following this object are listed in lexicographical order by object name.

Constraints

This parameter is used only for listing non-versioned objects.

Range

1 to 1,024 characters

Default Value

N/A

max-keys

Integer

No

Definition

Maximum number of objects returned in the response in lexicographical order.

Constraints

N/A

Range

The value ranges from 1 to 1000. If the specified value is greater than 1000, only 1,000 objects are returned.

Default Value

1000

delimiter

String

No

Definition

delimiter is the separator used to group object names. Up to 1,000 object names that share the same prefix are grouped into one CommonPrefixes. CommonPrefixes is returned in the response only when you specify the delimiter.

Assume that a bucket contains the objects 123/, a1/ and abc/, and the request specifies prefix= and delimiter=/.

The response will include commonPrefixes=[123/, a1/, abc/].

Note: If no prefix is specified, object names with the same string from the first character to the first delimiter are grouped into one CommonPrefixes.

Assume that a bucket contains the object 123/1.txt, and the request specifies prefix=123/ and delimiter=/.

The response will include commonPrefixes=[].

Note: If a prefix is specified, object names with the same string from the prefix to the first delimiter are grouped into one CommonPrefixes.

Assume that a bucket contains the object 123/a/1.txt, and the request specifies prefix=123/ and delimiter=/.

The response will include commonPrefixes=[123/a/].

For a parallel file system, if this parameter is not specified, all the content in the directory is recursively listed by default, including the content in subdirectories. If there are a large number of subdirectories, the request response may be slow or the request may fail. In big data scenarios, file systems usually have multiple directory levels and each directory level has a large number of objects. In such case, you are advised to configure [delimiter=/] to list the content in the current directory but exclude the content in subdirectories, thereby making the listing more efficient.

Constraints

N/A

Range

1 to 1,024 characters

Default Value

N/A

key-marker

String

No

Definition

Object name to start with when listing object versions in a bucket. All object versions following the specified value are listed in lexicographical order by object name.

Constraints

This field is used only for listing versioned objects.

Range

The value of NextKeyMarker in the response body of the last request

Default Value

N/A

version-id-marker

String

No

Definition

Version ID to start with when listing objects in a bucket. All objects following the specified value are listed in lexicographical order by object name and version ID. This parameter must be used together with key_marker. A maximum of 1,000 objects can be returned at a time. key_marker specifies the object name, and version_id_marker specifies the version of the specified object.

Constraints

  • This parameter is only used for listing objects with multiple versions.
  • If the value of version_id_marker is not a version ID that belongs to the object specified by key_marker, version_id_marker does not take effect.

Range

Object version ID, that is, the value of nextVersionIdMarker in the response body of the last request

Default Value

N/A

encoding-type

String

No

Definition

Encodes some elements in the response based on the specified type. If Delimiter, Marker (or KeyMarker), Prefix, NextMarker (or NextKeyMarker), and Key contain control characters that are not supported by XML 1.0 standards, you can configure encoding-type to encode Delimiter, Marker (or KeyMarker), Prefix (including the Prefix in CommonPrefixes), NextMarker (or NextKeyMarker), and Key in the response.

Constraints

Currently, only URL encoding is supported.

Range

URL

Default Value

N/A. If you do not specify this parameter, encoding is not applied.

Request Headers

This request uses common request headers. For details, see Table 3.

Request Body

This request contains no request body parameters.

Response Syntax

The response syntax is as follows. For details about the parameters in the response body, see Table 2.

HTTP/1.1 status_code
Date: GMT Date
x-obs-bucket-location: region
Content-Type: application/xml 
Content-Length: BodyLength
<Response Body>

Response Headers

This response uses common headers. For details, see Table 1.

Response Body

This response lists objects in XML format. Specific elements are described in Table 2.

Table 2 Response body parameters

Parameter

Type

Description

ListBucketResult

XML

Definition

A list of objects in a bucket.

Constraints

N/A

Range

N/A

Default Value

N/A

Contents

XML

Definition

Object metadata.

Parent: ListBucketResult

Constraints

N/A

Range

N/A

Default Value

N/A

CommonPrefixes

XML

Definition

Group information. If you specify a delimiter in the request, the response contains group information in CommonPrefixes.

Parent: ListBucketResult

Constraints

N/A

Range

N/A

Default Value

N/A

Delimiter

String

Definition

Separator used to group object names. If a prefix is specified, objects with the same string from the prefix to the first delimiter are grouped into one CommonPrefix. If no prefix is specified, objects with the same string from the first character to the first delimiter are grouped into one CommonPrefix.

Assume that a bucket has objects abcd, abcde, and bbcde in it. If delimiter is set to d and prefix is set to a, objects abcd and abcde are grouped into a commonPrefix with abcd as the prefix. If only delimiter is set to d, objects abcd and abcde are grouped into a commonPrefix with abcd as the prefix, and bbcde is grouped separately into another commonPrefix with bbcd as the prefix.

Parent: ListBucketResult

Constraints

N/A

Range

1 to 1,024 characters

Default Value

N/A

EncodingType

String

Definition

Encodes some elements in the response based on the specified type. If encoding-type is specified in the request, Delimiter, Marker, Prefix (including the Prefix in CommonPrefixes), NextMarker, and Key in the response will be encoded.

Parent: ListBucketResult

Constraints

Currently, only URL encoding is supported.

Range

URL

Default Value

N/A. If you do not specify this parameter, encoding is not applied.

ETag

String

Definition

Base64-encoded 128-bit MD5 digest of an object. ETag is the unique identifier of the object content. It can be used to determine whether the object content is changed. For example, if the ETag value is A when an object is uploaded, but this value has changed to B when the object is downloaded, it indicates that the object content has been changed. The ETag value is a hash of the object. The ETag reflects changes to the object content, rather than the object metadata. An uploaded object or copied object has a unique ETag after being encrypted using MD5.

Parent: ListBucketResult.Contents

Constraints

If the object is encrypted on the server side, the ETag value is not the MD5 digest of the object, but the unique identifier calculated through server-side encryption.

Range

The value must contain 32 characters.

Default Value

N/A

Type

String

Definition

Object type.

Parent: ListBucketResult.Contents

Constraints

This parameter is returned when the object is not a Normal object.

Range

  • NORMAL: normal objects
  • APPENDABLE: appendable objects

Default Value

N/A

ID

String

Definition

Domain ID of the object owner.

Parent: ListBucketResult.Contents.Owner

Constraints

N/A

Range

DomainId

Default Value

N/A

IsTruncated

Boolean

Definition

Whether all results are returned in the response.

Parent: ListBucketResult

Constraints

N/A

Range

  • true: Not all results are returned.
  • false: All results are returned.

Default Value

N/A

Key

String

Definition

Object name. An object is uniquely identified by an object name in a bucket. An object name is a complete path that does not contain the bucket name.

For example, if the access path is examplebucket.obs.ap-southeast-1.myhuaweicloud.com/folder/test.txt, the object name is folder/test.txt.

Parent: ListBucketResult.Contents

Constraints

See Object Overview.

Range

1 to 1,024 characters

Default Value

N/A

LastModified

Date

Definition

UTC time when an object was last modified.

Parent: ListBucketResult.Contents

Constraints

The date is in the ISO8601 format.

Example: 2018-01-01T00:00:00.000Z

Range

N/A

Default Value

N/A

Marker

String

Definition

Name of the object to start with when listing objects in a bucket. All objects following this object are listed in lexicographical order by object name.

Assume that you have the following objects: test/a, test/b, test/c, and test/d. If you specify test/b as the marker, test/c and test/d are returned.

Parent: ListBucketResult

Constraints

N/A

Range

1 to 1,024 characters

Default Value

N/A

NextMarker

String

Definition

The last object in the returned list. This parameter is returned when not all the objects are listed. You can set the Marker value to list the remaining objects in follow-up requests.

Parent: ListBucketResult

Constraints

N/A

Range

An object name string

Default Value

N/A

MaxKeys

String

Definition

Maximum number of objects returned in the response in lexicographical order.

Parent: ListBucketResult

Constraints

N/A

Range

The value ranges from 1 to 1000. If a value larger than 1000 is specified, 1000 is used.

Default Value

1000

Name

String

Definition

Bucket name.

Parent: ListBucketResult

Constraints

  • A bucket name must be unique across all accounts and regions.
  • A bucket name:
    • Must be 3 to 63 characters long and start with a digit or letter. Lowercase letters, digits, hyphens (-), and periods (.) are allowed.
    • Cannot be formatted as an IP address.
    • Cannot start or end with a hyphen (-) or period (.).
    • Cannot contain two consecutive periods (..), for example, my..bucket.
    • Cannot contain a period (.) and a hyphen (-) adjacent to each other, for example, my-.bucket or my.-bucket.
  • If you repeatedly create buckets of the same name in the same region, no error will be reported and the bucket attributes comply with those set in the first creation request.

Default Value

N/A

Owner

XML

Definition

User information, including the domain ID and name of the object owner.

Parent: ListBucketResult.Contents

Constraints

N/A

Range

N/A

Default Value

N/A

DisplayName

String

Definition

Name of the object owner.

Parent: ListBucketResult.Contents.Owner

Constraints

N/A

Range

N/A

Default Value

N/A

Prefix

String

Definition

Name prefix that the objects to be listed must contain.

Assume that you have the following objects: logs/day1, logs/day2, logs/day3, and ExampleObject.jpg. If you specify logs/ as the prefix, logs/day1, logs/day2, and logs/day3 will be returned. If you leave this parameter blank and there are also no other filters specified, all objects in the bucket will be returned.

Parent: ListBucketResult

Constraints

The prefix you specified must already exist in the bucket.

Range

1 to 1,024 characters

Default Value

N/A

Size

String

Definition

Object size in bytes.

Parent: ListBucketResult.Contents

Constraints

N/A

Range

The value ranges from 0 TB to 48.8 TB, in bytes.

Default Value

N/A

StorageClass

String

Definition

Storage class of an object.

Parent: ListBucketResult.Contents

Constraints

N/A

Range

  • STANDARD
  • WARM
  • COLD

Default Value

N/A

Table 3 Response body parameters for listing object versions

Parameter

Type

Description

ListVersionsResult

Container

Definition

Container for the list of objects (including object versions).

Constraints

N/A

Range

N/A

Default Value

N/A

Name

String

Definition

Bucket name.

Parent: ListVersionsResult

Constraints

  • A bucket name must be unique across all accounts and regions.
  • A bucket name:
    • Must be 3 to 63 characters long and start with a digit or letter. Lowercase letters, digits, hyphens (-), and periods (.) are allowed.
    • Cannot be formatted as an IP address.
    • Cannot start or end with a hyphen (-) or period (.).
    • Cannot contain two consecutive periods (..), for example, my..bucket.
    • Cannot contain a period (.) and a hyphen (-) adjacent to each other, for example, my-.bucket or my.-bucket.
  • If you repeatedly create buckets of the same name in the same region, no error will be reported and the bucket attributes comply with those set in the first creation request.

Range

N/A

Default Value

N/A

EncodingType

String

Definition

Encodes some elements in the response based on the specified type. If encoding-type is specified in the request, Delimiter, KeyMarker, Prefix (including the Prefix in CommonPrefixes), NextKeyMarker, and Key in the response will be encoded.

Parent: ListVersionsResult

Constraints

Currently, only URL encoding is supported.

Range

URL

Default Value

N/A. If you do not specify this parameter, encoding is not applied.

Prefix

String

Definition

Name prefix that the objects to be listed must contain.

Assume that you have the following objects: logs/day1, logs/day2, logs/day3, and ExampleObject.jpg. If you specify logs/ as the prefix, logs/day1, logs/day2, and logs/day3 will be returned. If you leave this parameter blank and there are also no other filters specified, all objects in the bucket will be returned.

Parent: ListVersionsResult

Constraints

The prefix you specified must already exist in the bucket.

Range

1 to 1,024 characters

Default Value

N/A

KeyMarker

String

Definition

Name of the object to start with when listing objects in a bucket. All objects following this object are listed in lexicographical order by object name.

Assume that you have the following objects: test/a, test/b, test/c, and test/d. If you specify test/b as the marker, test/c and test/d are returned.

Parent: ListVersionsResult

Constraints

This parameter is used only for listing versioned objects.

Range

1 to 1,024 characters

Default Value

N/A

VersionIdMarker

String

Definition

Version ID to start with when listing versioned objects, which is consistent with that set in the request.

Constraints

This parameter is used only for listing versioned objects.

Range

The value must contain 32 characters.

Default Value

N/A

NextKeyMarker

String

Definition

Start position when listing versioned objects in the next request. Key marker for the last returned object in the list. NextKeyMarker is returned when not all the objects are listed. You can set the KeyMarker value to list the remaining objects in follow-up requests.

Parent: ListVersionsResult

Constraints

N/A

Range

An object name string

Default Value

N/A

NextVersionIdMarker

String

Definition

Version ID to start with when listing versioned objects in the next request. It is used with the nextKeyMarker parameter. Version ID marker for the last returned object in the list. NextVersionIdMarker is returned when not all the objects are listed. You can set the VersionIdMarker value to list the remaining objects in follow-up requests.

Parent: ListVersionsResult

Constraints

This parameter is used only for listing versioned objects.

Range

The value must contain 32 characters.

Default Value

N/A

MaxKeys

String

Definition

Maximum number of objects returned in the response in lexicographical order.

Parent: ListVersionsResult

Constraints

N/A

Range

The value ranges from 1 to 1000. If a value larger than 1000 is specified, 1000 is used.

Default Value

1000

IsTruncated

Boolean

Definition

Whether all results are returned in the response.

Parent: ListVersionsResult

Constraints

N/A

Range

  • true: Not all results are returned.
  • false: All results are returned.

Default Value

N/A

Version

Container

Definition

Container that contains the version information.

Parent: ListVersionsResult

Constraints

N/A

Range

N/A

Default Value

N/A

DeleteMarker

Container

Definition

Container for objects with delete markers.

Parent: ListVersionsResult

Constraints

N/A

Range

N/A

Default Value

N/A

Key

String

Definition

Name of an object version. An object is uniquely identified by an object name in a bucket. An object name is a complete path that does not contain the bucket name.

For example, if the access path is examplebucket.obs.ap-southeast-1.myhuaweicloud.com/folder/test.txt, the object name is folder/test.txt.

Parent: ListVersionsResult.Version | ListVersionsResult.DeleteMarker

Constraints

See Object Overview.

Range

1 to 1,024 characters

Default Value

N/A

VersionId

String

Definition

Object version ID.

Parent: ListVersionsResult.Version | ListVersionsResult.DeleteMarker

Constraints

N/A

Range

The value must contain 32 characters.

Default Value

N/A

IsLatest

Boolean

Definition

Whether the object is of the latest version.

Parent: ListVersionsResult.Version | ListVersionsResult.DeleteMarker

Constraints

N/A

Range

  • true: The version is the latest.
  • false: The version is not the latest.

Default Value

N/A

LastModified

Date

Definition

UTC time when an object was last modified.

Parent: ListVersionsResult.Version | ListVersionsResult.DeleteMarker

Constraints

The date is in the ISO8601 format.

Example: 2018-01-01T00:00:00.000Z

Range

N/A

Default Value

N/A

ETag

String

Definition

Base64-encoded 128-bit MD5 digest of an object. ETag is the unique identifier of the object content. It can be used to determine whether the object content is changed. For example, if the ETag value is A when an object is uploaded, but this value has changed to B when the object is downloaded, it indicates that the object content has been changed. The ETag value is a hash of the object. The ETag reflects changes to the object content, rather than the object metadata. An uploaded object or copied object has a unique ETag after being encrypted using MD5.

Parent: ListVersionsResult.Version

Constraints

N/A

Range

The value must contain 32 characters.

Default Value

N/A

Type

String

Definition

Object type.

Parent: ListVersionsResult.Version

Constraints

This parameter is returned when the object is not a Normal object.

Range

  • NORMAL: normal objects
  • APPENDABLE: appendable objects

Default Value

N/A

Size

String

Definition

Object size in bytes.

Parent: ListVersionsResult.Version

Constraints

N/A

Range

The value ranges from 0 TB to 48.8 TB, in bytes.

Default Value

N/A

Owner

Container

Definition

User information, including the domain ID and name of the object owner.

Parent: ListVersionsResult.Version | ListVersionsResult.DeleteMarker

Constraints

N/A

Range

N/A

Default Value

N/A

ID

String

Definition

Domain ID of the object owner.

Parent: ListVersionsResult.Version.Owner | ListVersionsResult.DeleteMarker.Owner

Constraints

N/A

Range

DomainId

Default Value

N/A

DisplayName

String

Definition

Name of the object owner.

Parent: ListVersionsResult.Version.Owner | ListVersionsResult.DeleteMarker.Owner

Constraints

N/A

Range

N/A

Default Value

N/A

StorageClass

String

Definition

Storage class of an object.

Parent: ListVersionsResult.Version

Constraints

N/A

Range

  • STANDARD
  • WARM
  • COLD

Default Value

N/A

CommonPrefixes

Container

Definition

Group information. If you specify a delimiter in the request, the response contains group information in CommonPrefixes.

Parent: ListVersionsResult

Constraints

N/A

Range

N/A

Default Value

N/A

Prefix

String

Definition

Indicates a different prefix in the group information in CommonPrefixes.

Parent: ListVersionsResult.CommonPrefixes

Constraints

The prefix you specified must already exist in the bucket.

Range

1 to 1,024 characters

Default Value

N/A

Error Responses

No special errors. You can find all errors in Error Code Overview.

Sample Request: Listing All Objects

1
2
3
4
5
6
GET / HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: Wed, 01 Jul 2015 02:28:25 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:KiyoYze4pmRNPYfmlXBfRTVxt8c=

Sample Response: Listing All Objects

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: BF260000016435D34E379ABD93320CB9
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSXiN7GPL/yXM6OSBaYCUV1zcY5OelWp
Content-Type: application/xml
Date: Wed, 01 Jul 2015 02:23:30 GMT
Content-Length: 586

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ListBucketResult xmlns="http://obs.ap-southeast-1.myhuaweicloud.com/doc/2015-06-30/">
  <Name>examplebucket</Name>
  <Prefix></Prefix>
  <Marker></Marker>
  <MaxKeys>1000</MaxKeys>
  <IsTruncated>false</IsTruncated>
  <Contents>
    <Key>object001</Key>
    <LastModified>2015-07-01T00:32:16.482Z</LastModified>
    <ETag>"2fa3bcaaec668adc5da177e67a122d7c"</ETag>
    <Size>12041</Size>
    <Owner>
      <ID>b4bf1b36d9ca43d984fbcb9491b6fce9</ID>
      <DisplayName>ObjectOwnerName</DisplayName>
    </Owner>
    <StorageClass>STANDARD</StorageClass>
  </Contents>
</ListBucketResult>

Sample Request: Listing Some Objects

Assume that you have a bucket examplebucket that contains objects newfile, obj001, obj002, and obs001. If you want to list only object obj002, the request message is as follows:

GET /?marker=obj001&prefix=obj HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: Wed, 01 Jul 2015 02:28:25 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:KiyoYze4pmRNPYfmlXBfRTVxt8c=

Sample Response: Listing Some Objects

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: BF260000016435D758FBA857E0801874
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCShn/xAyk/xHBX6qgGSB36WXrbco0X80
Content-Type: application/xml
Date: Wed, 01 Jul 2015 02:29:48 GMT
Content-Length: 707

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ListBucketResult xmlns="http://obs.ap-southeast-1.myhuaweicloud.com/doc/2015-06-30/">
<Name>examplebucket</Name>
<Prefix>obj</Prefix>
<Marker>obj001</Marker>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
  <Contents>
    <Key>obj002</Key>
    <LastModified>2015-07-01T02:11:19.775Z</LastModified>
    <ETag>"a72e382246ac83e86bd203389849e71d"</ETag>
    <Size>9</Size>
    <Owner>
      <ID>b4bf1b36d9ca43d984fbcb9491b6fce9</ID>
      <DisplayName>ObjectOwnerName</DisplayName>
    </Owner>
    <StorageClass>STANDARD</StorageClass>
  </Contents>
</ListBucketResult>

Sample Request: Listing Some Objects

Assume a user has a bucket named examplebucket. The bucket contains three objects: abcd, abcde, and bbcde. If the filter criteria are specified (the prefix is a and the delimiter is d), objects with the same characters between a and d are grouped into one group. In this example, abcd and abcde are grouped into one group with abcd as the CommonPrefixes.

The specific request format is as follows:

GET /?prefix=a&delimiter=d HTTP/1.1
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:iqSPeUBl66PwXDApxjRKk6hlcN4=
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Date: Wed, 01 Jul 2015 02:37:22 GMT
Content-Type: application/xml;charset=UTF-8

Sample Response: Listing Some Objects

HTTP/1.1 200 OK
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSsokG49mPTa0cU5U/4gjFYLmYPgfYs/
x-obs-request-id: 0000018A2A563686D2C61543407D6ABF
Server: OBS
x-obs-bucket-location: region
Content-Length: 333
Date: Wed, 01 Jul 2015 02:37:22 GMT
Content-Type: application/xml
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ListBucketResult  xmlns="http://obs.myhuaweicloud.com/doc/2015-06-30/">
    <Name>examplebucket</Name>
    <Prefix>a</Prefix>
    <Marker></Marker>
    <MaxKeys>1000</MaxKeys>
    <Delimiter>d</Delimiter>
    <IsTruncated>false</IsTruncated>
    <CommonPrefixes>
        <Prefix>abcd</Prefix>
    </CommonPrefixes>
</ListBucketResult>

Sample Request: Listing Object Versions

1
2
3
4
5
6
GET /?versions HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: Wed, 01 Jul 2015 02:29:45 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:iZeDESIMxBK2YODk7vIeVpyO8DI=

Sample Response: Listing Object Versions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: BF260000016435D758FBA857E0801874
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCShn/xAyk/xHBX6qgGSB36WXrbco0X80
Content-Type: application/xml
Date: Wed, 01 Jul 2015 02:29:48 GMT
Content-Length: 707

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ListVersionsResult xmlns="http://obs.ap-southeast-1.myhuaweicloud.com/doc/2015-06-30/">
 <Name>bucket02</Name>
 <Prefix></Prefix>
 <KeyMarker></KeyMarker>
  <VersionIdMarker/>
  <MaxKeys>1000</MaxKeys>
  <IsTruncated>false</IsTruncated>
  <Version>
    <Key>object001</Key>
    <VersionId>G001119F25E10207FFFF83E508C65720</VersionId>
    <IsLatest>true</IsLatest>
    <LastModified>2015-07-01T00:32:16.482Z</LastModified>
    <ETag>"2fa3bcaaec668adc5da177e67a122d7c"</ETag>
    <Size>12041</Size>
    <Owner>
      <ID>b4bf1b36d9ca43d984fbcb9491b6fce9</ID>
      <DisplayName>ObjectOwnerName</DisplayName>
    </Owner>
    <StorageClass>STANDARD</StorageClass>
  </Version>
</ListVersionsResult>

Sample Request: Listing Objects (Including Archive Objects) in a Bucket

GET / HTTP/1.1
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:iqSPeUBl66PwXDApxjRKk6hlcN4=
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Date: Wed, 01 Jul 2015 02:37:22 GMT
Content-Type: application/xml;charset=UTF-8

Sample Response: Listing Objects (Including Archive Objects) in a Bucket

HTTP/1.1 200 OK
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSWqA48YKdA2aExVAgcpwubHQO5wd9ww
x-obs-request-id: 0000018A2A5FE372D308213442F9065F
Server: OBS
x-obs-bucket-location: region
Content-Length: 497
Date: Wed, 01 Jul 2015 02:37:22 GMT
Content-Type: application/xml
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ListBucketResult  xmlns="http://obs.myhuaweicloud.com/doc/2015-06-30/">
    <Name>examplebucket</Name>
    <Prefix></Prefix>
    <Marker></Marker>
    <MaxKeys>1000</MaxKeys>
    <IsTruncated>false</IsTruncated>
    <Contents>
        <Key>abcd.txt</Key>
        <LastModified>2014-08-25T01:47:00.838Z</LastModified>
        <ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag>
        <Size>0</Size>
        <Owner>
            <ID>d029cb567d464a93pdl9v800575ee4cf</ID>
            <DisplayName>ObjectOwnerName</DisplayName>
        </Owner>
        <StorageClass>COLD</StorageClass>
    </Contents>
</ListBucketResult>

Using SDKs to Call APIs

You are advised to use OBS SDKs to call APIs. SDKs encapsulate APIs to simplify development. You can call SDK API functions to access OBS without manually calculating signatures.

Helpful Links

  • To use obsutil to list objects in a bucket, see Listing Objects.
  • For more information about listing objects in a bucket, see Listing Objects.
  • Calling the API for listing objects in a bucket will incur fees. For details, see Requests.