List Objects

Description

This action lists the objects under Bucket.
A single operation can list up to 1000 objects. If you need to list all the objects under Bucket, you need to loop through the operation.
You can list only objects that contain a specific prefix under the Bucket by using the prefix parameter. The delimiter parameter can be used to aggregate objects of the same prefix. For example, there are 2016/05.log and 2016/06.log under bucket, and if you specify delimiter as '/', only 2016 of this public prefix is returned.

Note

Restful API

Reference

Note

If both prefix and delimiter are non-null, prefix must end with delimiter.

SDK Interface

  • Java SDK: listObjects, listNextBatchOfObjects
  • go SDK: List_Object, List_Next_Batch_Of_Objects
  • C++ SDK: listObjects, listNextBatchOfObjects
  • Php SDK: listObjects, listNextBatchOfObjects
  • python SDK: list_objects, list_next_batch_of_objects

Parameter Usage Example

Suppose the fds-demo below has the following objects

  • bar/bang/bang
  • bar/baz
  • bee
  • foo/bang
  • foo/bash

Request Samples (both prefix and delimiter are null)

PUT /test-bucket-name?prefix=&delimiter= HTTP/1.1
HOST: files.fds.api.xiaomi.com
Content-Length: 0
Date: Wed, 01 Mar  2006 12:00:00 GMT
Authorization: <font color=red>authorization string</font>

Response Sample

HTTP/1.1 200 OK
Date: Wed, 01 Mar  2006 12:00:00 GMT
Content-Length: 535
Connection: close

{"commonPrefixes":[],"delimiter":"","marker":"","maxKeys":1000,"name":"test-bucket-name","objects":[{"name":"bar/bang/bang","owner":{"id":"109934"},"size":14,"uploadTime":1453881434148},{"name":"bar/baz","owner":{"id":"109934"},"size":14,"uploadTime":1453881434167},{"name":"bee","owner":{"id":"109934"},"size":14,"uploadTime":1453881434181},{"name":"foo/bang","owner":{"id":"109934"},"size":14,"uploadTime":1453881434129},{"name":"foo/bash","owner":{"id":"109934"},"size":14,"uploadTime":1453881433642}],"prefix":"","truncated":false}

Request sample (prefix non-null, delimiter null)

PUT /test-bucket-name?prefix=foo&delimiter= HTTP/1.1
HOST: files.fds.api.xiaomi.com
Content-Length: 0
Date: Wed, 01 Mar  2006 12:00:00 GMT
Authorization: <font color=red>authorization string</font>

Response Sample

HTTP/1.1 200 OK
Date: Wed, 01 Mar  2006 12:00:00 GMT
Content-Length: 296
Connection: close

{"commonPrefixes":[],"delimiter":"","marker":"","maxKeys":1000,"name":"test-bucket-name","objects":[{"name":"foo/bang","owner":{"id":"109934"},"size":14,"uploadTime":1453881434129},{"name":"foo/bash","owner":{"id":"109934"},"size":14,"uploadTime":1453881433642}],"prefix":"foo","truncated":false}

Request Sample (prefix null, delimiter non-null)

PUT /test-bucket-name?prefix=&delimiter=/ HTTP/1.1
HOST: files.fds.api.xiaomi.com
Content-Length: 0
Date: Wed, 01 Mar  2006 12:00:00 GMT
Authorization: <font color=red>authorization string</font>

Response Sample

HTTP/1.1 200 OK
Date: Wed, 01 Mar  2006 12:00:00 GMT
Content-Length: 221
Connection: close

{"commonPrefixes":["bar/","foo/"],"delimiter":"/","marker":"","maxKeys":1000,"name":"test-bucket-name","objects":[{"name":"bee","owner":{"id":"109934"},"size":14,"uploadTime":1453881434181}],"prefix":"","truncated":false}

Request Sample (prefix and delimiter non-null)

PUT /test-bucket-name?prefix=bar/&delimiter=/ HTTP/1.1
HOST: files.fds.api.xiaomi.com
Content-Length: 0
Date: Wed, 01 Mar  2006 12:00:00 GMT
Authorization: <font color=red>authorization string</font>

Response Sample

HTTP/1.1 200 OK
Date: Wed, 01 Mar  2006 12:00:00 GMT
Content-Length: 227
Connection: close

{"commonPrefixes":["bar/bang/"],"delimiter":"/","marker":"","maxKeys":1000,"name":"test-bucket-name","objects":[{"name":"bar/baz","owner":{"id":"109934"},"size":14,"uploadTime":1453881434167}],"prefix":"bar/","truncated":false}

results matching ""

    No results matching ""