Obtaining Bucket Metadata

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference

You can call ObsClient.getBucketMetadata to obtain the metadata of a bucket. Sample code is as follows:

String endPoint = "https://your-endpoint";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
// Create an instance of ObsClient.
ObsClient obsClient = new ObsClient(ak, sk, endPoint);

BucketMetadataInfoRequest request = new BucketMetadataInfoRequest("bucketname");
request.setOrigin("http://www.a.com");
//Obtain bucket metadata.
BucketMetadataInfoResult result = obsClient.getBucketMetadata(request);
Log.i("GetBucketMetadata", "\t:" + result.getDefaultStorageClass());
Log.i("GetBucketMetadata", "\t:" + result.getAllowOrigin());
Log.i("GetBucketMetadata", "\t:" + result.getMaxAge());
Log.i("GetBucketMetadata", "\t:" + result.getAllowHeaders());
Log.i("GetBucketMetadata", "\t:" + result.getAllowMethods());
Log.i("GetBucketMetadata", "\t:" + result.getExposeHeaders());

For details about values of methods, such as BucketMetadataInfoResult.getAllowMethods, see the CORS configurations of the bucket.