A bucket is a container used to store objects in Object Storage Service (OSS). All objects in OSS are contained in buckets. This topic describes how to query the information about a bucket.


The following code provides an example on how to query the information about a bucket named examplebucket, including the region, creation date, and ACL of the bucket:

OSSGetBucketInfoRequest *request = [OSSGetBucketInfoRequest new];
// Specify the name of the bucket. Example: examplebucket. 
request.bucketName = @"examplebucket";
// Query the information about the bucket. 
OSSTask * getBucketInfoTask = [client getBucketInfo:request];

[getBucketInfoTask continueWithBlock:^id(OSSTask *task) {
    if (!task.error) {
        OSSGetBucketInfoResult *result = task.result;
        NSLog(@ "Creation date:%@", result.creationDate);
        NSLog(@ "Region:%@", result.location);
        NSLog(@ "Storage class:%@", result.storageClass);
        NSLog(@ "Owner:%@", result.owner.userName);
        NSLog(@ "ACL:%@", result.acl.grant);
    } else {
        NSLog(@"get bucket info failed, error: %@", task.error);
    return nil;


  • For the complete sample code that is used to query information about a bucket, visit GitHub.
  • For more information about the API operation that you can call to query the information about a bucket, see GetBucketInfo.