GetService (ListBuckets)

Last Updated: Jun 15, 2017

Sending a Get request to the server can return all buckets owned by the requester, and “/“ represents the root directory.

Request syntax

  1. GET / HTTP/1.1
  2. Host: oss.aliyuncs.com
  3. Date: GMT Date
  4. Authorization: SignatureValue

Request parameters

When using GetService(ListBuckets), you can prescribe a limit to the list with prefix, marker and max-uploads to return partial results.

Name Description
prefix Indicates that only the buckets whose names match a specified prefix are returned. If this parameter is not specified, prefix information is not used as a filter.
Data type: string
Default value: None
marker Indicates that the returned results start with the first entry after the marker in alphabetical order. If this parameter is not specified, all entries are returned from the start.
Data type: string
Default value: None
max-keys Limits the maximum number of buckets returned for one request. If this parameter is not specified, the default value 100 is used. The value cannot exceed 1000.
Data type: string
Default value: 100

Response elements

Name Description
ListAllMyBucketsResult Container for saving results of the Get Service request.
Type: container
Subnode: Owner and Buckets
Parent node: None
Prefix Prefix of the returned bucket names for one request. This node is available only when not all buckets are returned.
Type: string
Parent node: ListAllMyBucketsResult
Marker Start point of the current GetService(ListBuckets) request. This node is available only when not all buckets are returned.
Type: string
Parent node: ListAllMyBucketsResult
MaxKeys The maximum number of returned results for one request. This node is available only when not all buckets are returned.
Type: string
Parent node: ListAllMyBucketsResult
IsTruncated Indicates whether all results have been returned. “true” means that not all results are returned this time; “false” means that all results are returned this time. This node is available only when not all buckets are returned.
Type: enumerated string
Valid values: “true” and “false”
Parent node: ListAllMyBucketsResult
NextMarker to indicate that this can be taken as the marker for the next GetService(ListBuckets) request to return unreturned results. This node is available only when not all buckets are returned.
Type: string
Parent node: ListAllMyBucketsResult
Owner Container used for saving the information about the bucket owner.
Type: container
Parent node: ListAllMyBucketsResult
ID User ID of the bucket owner.
Type: string
Parent node: ListAllMyBucketsResult.Owner
DisplayName Name of the bucket owner (the same as the ID currently).
Type: string
Parent node: ListAllMyBucketsResult.Owner
Buckets Container used for saving the information about multiple Buckets.
Type: container
Subnode: Bucket
Parent node: ListAllMyBucketsResult
Bucket Container used for saving the bucket information.
Type: container
Subnodes: Name, CreationDate, and Location
Parent node: ListAllMyBucketsResult.Buckets
Name Bucket name.
Type: string
Parent node: ListAllMyBucketsResult.Buckets.Bucket
CreateDate Bucket creation time
Type: time (format: yyyy-mm-ddThh:mm:ss.timezone, for example, 2011-12-01T12:27:13.000Z)
Parent node: ListAllMyBucketsResult.Buckets.Bucket
Location Indicates the data center in which a bucket is located
Type: string
Parent node: ListAllMyBucketsResult.Buckets.Bucket
ExtranetEndpoint Internet domain name accessed by the bucket
Type: string
Parent node: ListAllMyBucketsResult.Buckets.Bucket
IntranetEndpoint Intranet domain name accessed by the ECS in the same region
Type: string
Parent node: ListAllMyBucketsResult.Buckets.Bucket
StorageClass Indicates the bucket storage type. “Standard”, “IA”, and “Archive” types are available. (The “Archive” type is only available in some regions currently.)
Type: string
Parent node: ListAllMyBucketsResult.Buckets.Bucket

Detail analysis

  1. The API of GetService is valid only for those users who have been authenticated.
  2. If no information for user authentication is provided in a request (namely an anonymous access), 403 Forbidden is returned. The error code is “AccessDenied”.
  3. When all buckets are returned, the returned xml does not contain the nodes Prefix, Marker, MaxKeys, IsTruncated and NextMarker. If some results are not returned yet, the above nodes are added, in which NextMarker is used to assign the marker for successive query.

Example

Request example I

  1. GET / HTTP/1.1
  2. Date: Thu, 15 May 2014 11:18:32 GMT
  3. Host: oss-cn-hangzhou.aliyuncs.com
  4. Authorization: OSS nxj7dtl1c24jwhcyl5hpvnhi:COS3OQkfQPnKmYZTEHYv2qUl5jI=

Return example I

  1. HTTP/1.1 200 OK
  2. Date: Thu, 15 May 2014 11:18:32 GMT
  3. Content-Type: application/xml
  4. Content-Length: 556
  5. Connection: keep-alive
  6. Server: AliyunOSS
  7. x-oss-request-id: 5374A2880232A65C23002D74
  8. <?xml version="1.0" encoding="UTF-8"?>
  9. <ListAllMyBucketsResult>
  10. <Owner>
  11. <ID>51264</ID>
  12. <DisplayName>51264</DisplayName>
  13. </Owner>
  14. <Buckets>
  15. <Bucket>
  16. <CreationDate>2015-12-17T18:12:43.000Z</CreationDate>
  17. <ExtranetEndpoint>oss-cn-shanghai.aliyuncs.com</ExtranetEndpoint>
  18. <IntranetEndpoint>oss-cn-shanghai-internal.aliyuncs.com</IntranetEndpoint>
  19. <Location>oss-cn-shanghai</Location>
  20. <Name>app-base-oss</Name>
  21. <StorageClass>Standard</StorageClass>
  22. </Bucket>
  23. <Bucket>
  24. <CreationDate>2014-12-25T11:21:04.000Z</CreationDate>
  25. <ExtranetEndpoint>oss-cn-hangzhou.aliyuncs.com</ExtranetEndpoint>
  26. <IntranetEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</IntranetEndpoint>
  27. <Location>oss-cn-hangzhou</Location>
  28. <Name>atestleo23</Name>
  29. <StorageClass>IA</StorageClass>
  30. </Bucket>
  31. </Buckets>
  32. </ListAllMyBucketsResult>

Request example II

  1. GET /?prefix=xz02tphky6fjfiuc&max-keys=1 HTTP/1.1
  2. Date: Thu, 15 May 2014 11:18:32 GMT
  3. Host: oss-cn-hangzhou.aliyuncs.com
  4. Authorization: OSS nxj7dtl1c24jwhcyl5hpvnhi:COS3OQkfQPnKmYZTEHYv2qUl5jI=

Return example II

  1. HTTP/1.1 200 OK
  2. Date: Thu, 15 May 2014 11:18:32 GMT
  3. Content-Type: application/xml
  4. Content-Length: 545
  5. Connection: keep-alive
  6. Server: AliyunOSS
  7. x-oss-request-id: 5374A2880232A65C23002D75
  8. <?xml version="1.0" encoding="UTF-8"?>
  9. <ListAllMyBucketsResult>
  10. <Prefix>xz02tphky6fjfiuc</Prefix>
  11. <Marker></Marker>
  12. <MaxKeys>1</MaxKeys>
  13. <IsTruncated>true</IsTruncated>
  14. <NextMarker>xz02tphky6fjfiuc0</NextMarker>
  15. <Owner>
  16. <ID>ut_test_put_bucket</ID>
  17. <DisplayName>ut_test_put_bucket</DisplayName>
  18. </Owner>
  19. <Buckets>
  20. <Bucket>
  21. <CreationDate>2014-05-15T11:18:32.000Z</CreationDate>
  22. <ExtranetEndpoint>oss-cn-hangzhou.aliyuncs.com</ExtranetEndpoint>
  23. <IntranetEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</IntranetEndpoint>
  24. <Location>oss-cn-hangzhou</Location>
  25. <Name>xz02tphky6fjfiuc0</Name>
  26. <StorageClass>Standard</StorageClass>
  27. </Bucket>
  28. </Buckets>
  29. </ListAllMyBucketsResult>
Thank you! We've received your feedback.