A bucket is a container for objects stored in OSS. Every object is contained in a bucket. 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];
request.bucketName = @"examplebucket";

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;