• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (OBS)
  4. Operations on Buckets
  5. GET Bucket (List Objects)
  6. Examples

Examples

Sample Request

GET / HTTP/1.1
 User-Agent: Jakarta Commons-HttpClient/3.1 
 Host: bucketname.obs.example.com
 Accept: */*
 Date: Sun, 26 Sep 2010 09:16:00 GMT  
 Authorization: AWS 04RZT432N80TGDF2Y2G2:QaTwEcRs5E4p/uahBMYHB+dY00k= 

Sample Response

HTTP/1.1 200 OK 
 Server: OBS 
 x-amz-request-id: 367CB63A2F283044981285492719060 
 x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc 
 x-amz-bucket-region: R1
 x-amz-id-2: MzY3Q0I2M0EyRjI4MzA0NDk4MTI4NTQ5MjcxOTA2MEFBQUFBQUFBYmJiYmJiYmJD 
 Content-Type: application/xml 
 Date: Sun, 26 Sep 2010 09:18:36 GMT 
 Content-Length: 560 

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
 <ListBucketResult xmlns="http://obs.example.com/doc/2015-06-30/"> 
 <Name>example</Name> 
 <Prefix></Prefix> 
 <Marker></Marker> 
 <MaxKeys>1000</MaxKeys> 
 <IsTruncated>false</IsTruncated> 
 <Contents> 
 <Key>test</Key> 
 <LastModified>2013-01-15T05:52:15.920Z</LastModified> 
 <ETag>0f64741bf7cb1089e988e4585d0d3434</ETag> 
 <Size>11</Size> 
 <Owner> 
 <ID>bcaf1ffd86f41caff1a493dc2ad8c2c281e37522a640e161ca5fb16fd081034f</ID> 
 <DisplayName>apple</DisplayName> 
 </Owner> 
 <StorageClass>STANDARD</StorageClass> 
 </Contents> 
 </ListBucketResult>

Sample Request (Example of listing objects in a bucket by specifying prefix)

GET /?prefix=photos/2006/&delimiter=/ HTTP/1.1 
 User-Agent: Jakarta Commons-HttpClient/3.1 
 Host: bucketname.obs.example.com
 Accept: */*
 Date: Sun, 26 Sep 2010 09:18:36 GMT 
 Authorization: AWS 04RZT432N80TGDF2Y2G2:QaTwEcRs5E4p/uahBMYHB+dY00k= 

Sample Response (Example of listing objects in a bucket by specifying prefix)

HTTP/1.1 200 OK 
 Server: OBS 
 x-amz-request-id: 367CB63A2F283044981285492719060 
 x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc 
 x-amz-bucket-region: R1
 x-amz-id-2: MzY3Q0I2M0EyRjI4MzA0NDk4MTI4NTQ5MjcxOTA2MEFBQUFBQUFBYmJiYmJiYmJD 
 Content-Type: application/xml 
 Date: Sun, 26 Sep 2010 09:18:36 GMT 
 Content-Length: 560 

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
 <ListBucketResult xmlns="http://obs.example.com/doc/2015-06-30/"> 
 <Name>example</Name> 
 <Prefix>photos/2006/</Prefix> 
 <Marker></Marker> 
 <MaxKeys>1000</MaxKeys> 
 <Delimiter>/</Delimiter> 
 <IsTruncated>false</IsTruncated> 
 <Contents> 
 <Key>photos/2006/index.html</Key> 
 <LastModified>2009-01-01T12:00:00.000Z</LastModified> 
 <ETag>ce1acdafcc879d7eee54cf4e97334078</ETag> 
 <Size>1234</Size> 
 <Owner> 
 <ID>214153b66967d86f031c7487b4566cb1b</ID> 
 <DisplayName>John Smith</DisplayName> 
 </Owner> 
 <StorageClass>STANDARD</StorageClass> 
 </Contents> 
 <CommonPrefixes> 
 <Prefix>photos/2006/January/</Prefix> 
 </CommonPrefixes> 
 </ListBucketResult>

Sample Request (list of objects in a bucket and the CORS configuration being obtained with CORS configured for the bucket)

GET / HTTP/1.1
User-Agent: curl/7.19.0 (x86_64-suse-linux-gnu) libcurl/7.19.0 OpenSSL/0.9.8{ zlib/1.2.3 libidn/1.10
Host: bucketname.obs.example.com
Accept: */*
Date: Tue, 28 Apr 2015 13:52:29 +0000
Authorization: AWS D13E0C94E722DD69423C:m/jxIj4ZYv4mjpk4xqlMTQKe7aQ=
Origin:www.example.com
Access-Control-Request-Headers:AllowedHeader_1

Sample Response (list of objects in a bucket and the CORS configuration being obtained with CORS configured for the bucket)

HTTP/1.1 200 OK
Server: OBS
x-amz-request-id: B50AD92B37C934BAD314B5EB0BB5BEF2
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
Access-Control-Allow-Origin: www.example.com
Access-Control-Allow-Methods: POST,GET,HEAD,PUT,DELETE
Access-Control-Allow-Headers: AllowedHeader_1
Access-Control-Max-Age: 100
Access-Control-Expose-Headers: ExposeHeader_1
x-amz-id-2: 1jSuajz0BqBC0sly+aYIIpbK4ETxBVeCYtBq3Lvc7H7zuCefvq9Kowtp0o3cmQ3X
Content-Type: application/xml
Date: Tue, 28 Apr 2015 13:52:29 GMT
Content-Length: 559