Listing Objects in a Bucket
Functions
This API is used to list 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 Information
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 need to grant 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 need to grant 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)
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 need to grant the obs:bucket:ListBucket (versioning disabled) and obs:bucket:ListBucketVersions (versioning enabled or suspended) permissions. For details, see Creating a Custom Bucket Policy.
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.
|
Parameter |
Type |
Mandatory (Yes/No) |
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 The value can contain 1 to 1,024 characters. Default Value None |
|
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 The value can contain 1 to 1,024 characters. Default Value None |
|
max-keys |
Integer |
No |
Definition The maximum number of objects returned in the response in lexicographical order Constraints None 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 None Range The value can contain 1 to 1,024 characters. Default Value None |
|
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 None |
|
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
Range Object version ID, that is, the value of nextVersionIdMarker in the response body of the last request Default Value None |
|
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 None. If you do not configure 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
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.
|
Parameter |
Type |
Description |
|---|---|---|
|
ListBucketResult |
XML |
Definition A list of objects in a bucket Constraints None Range None Default Value None |
|
Contents |
XML |
Definition Object metadata Parent: ListBucketResult Constraints None Range None Default Value None |
|
CommonPrefixes |
XML |
Definition Group information. If you specify a delimiter in the request, the response contains group information in CommonPrefixes. Parent: ListBucketResult Constraints None Range None Default Value None |
|
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 None Range The value can contain 1 to 1,024 characters. Default Value None |
|
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 None. If you do not configure 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 None |
|
Type |
String |
Definition Object type Parent: ListBucketResult.Contents Constraints This parameter is returned when the object is not a Normal object. Range
Default Value None |
|
ID |
String |
Definition Domain ID of the object owner Parent: ListBucketResult.Contents.Owner Constraints None Range Default Value None |
|
IsTruncated |
Boolean |
Definition Whether all results are returned in the response. Parent: ListBucketResult Constraints None Range
Default Value None |
|
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 The value can contain 1 to 1,024 characters. Default Value None |
|
LastModified |
Date |
Definition Time (UTC) 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 None Default Value None |
|
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 None Range The value can contain 1 to 1,024 characters. Default Value None |
|
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 None Range An object name string Default Value None |
|
MaxKeys |
String |
Definition The maximum number of objects returned in the response in lexicographical order Parent: ListBucketResult Constraints None 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
Default Value None |
|
Owner |
XML |
Definition User information, including the domain ID and name of the object owner Parent: ListBucketResult.Contents Constraints None Range None Default Value None |
|
DisplayName |
String |
Definition Name of the object owner Parent: ListBucketResult.Contents.Owner Constraints None Range None Default Value None |
|
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 The value can contain 1 to 1,024 characters. Default Value None |
|
Size |
String |
Definition Object size in bytes Parent: ListBucketResult.Contents Constraints None Range The value ranges from 0 TB to 48.8 TB, in bytes. Default Value None |
|
StorageClass |
String |
Definition Storage class of an object. Parent: ListBucketResult.Contents Constraints None Range
Default Value None |
|
Parameter |
Type |
Description |
|---|---|---|
|
ListVersionsResult |
Container |
Definition Container for the list of objects (including object versions) Constraints None Range None Default Value None |
|
Name |
String |
Definition Bucket name Parent: ListVersionsResult Constraints
Range None Default Value None |
|
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 None. If you do not configure 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 The value can contain 1 to 1,024 characters. Default Value None |
|
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 The value can contain 1 to 1,024 characters. Default Value None |
|
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 None |
|
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 None Range An object name string Default Value None |
|
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 None |
|
MaxKeys |
String |
Definition The maximum number of objects returned in the response in lexicographical order Parent: ListVersionsResult Constraints None 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 None Range
Default Value None |
|
Version |
Container |
Definition Container that contains the version information Parent: ListVersionsResult Constraints None Range None Default Value None |
|
DeleteMarker |
Container |
Definition Container for objects with delete markers Parent: ListVersionsResult Constraints None Range None Default Value None |
|
Key |
String |
Definition Name of the versioned object. 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 The value can contain 1 to 1,024 characters. Default Value None |
|
VersionId |
String |
Definition Object version ID Parent: ListVersionsResult.Version | ListVersionsResult.DeleteMarker Constraints None Range The value must contain 32 characters. Default Value None |
|
IsLatest |
Boolean |
Definition Whether the object is of the latest version Parent: ListVersionsResult.Version | ListVersionsResult.DeleteMarker Constraints None Range
Default Value None |
|
LastModified |
Date |
Definition Time (UTC) 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 None Default Value None |
|
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 None Range The value must contain 32 characters. Default Value None |
|
Type |
String |
Definition Object type Parent: ListVersionsResult.Version Constraints This parameter is returned when the object is not a Normal object. Range
Default Value None |
|
Size |
String |
Definition Object size in bytes Parent: ListVersionsResult.Version Constraints None Range The value ranges from 0 TB to 48.8 TB, in bytes. Default Value None |
|
Owner |
Container |
Definition User information, including the domain ID and name of the object owner Parent: ListVersionsResult.Version | ListVersionsResult.DeleteMarker Constraints None Range None Default Value None |
|
ID |
String |
Definition Domain ID of the object owner Parent: ListVersionsResult.Version.Owner | ListVersionsResult.DeleteMarker.Owner Constraints None Range Default Value None |
|
DisplayName |
String |
Definition Name of the object owner Parent: ListVersionsResult.Version.Owner | ListVersionsResult.DeleteMarker.Owner Constraints None Range None Default Value None |
|
StorageClass |
String |
Definition Storage class of an object Parent: ListVersionsResult.Version Constraints None Range
Default Value None |
|
CommonPrefixes |
Container |
Definition Group information. If you specify a delimiter in the request, the response contains group information in CommonPrefixes. Parent: ListVersionsResult Constraints None Range None Default Value None |
|
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 The value can contain 1 to 1,024 characters. Default Value None |
Error Responses
No special error responses are returned. For details about error responses, see Table 2.
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
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.myhwclouds.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>00011000000000013F16000001643A22E476FFFF9046024ECA3655445346485a</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.myhwclouds.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>
</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.
References
- 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot

