Obtaining Object Properties
You can call getObjectMetaData to obtain properties of an object, including the length, MIME type, and customized metadata. Sample code is as follows:
static OBSClient *client;
NSString *endPoint = @"your-endpoint";
NSString *SK = @"*** Provide your Secret Key ***";
NSString *AK = @"*** Provide your Access Key ***";
// Initialize identity authentication.
OBSStaticCredentialProvider *credentialProvider = [[OBSStaticCredentialProvider alloc] initWithAccessKey:AK secretKey:SK];
//Initialize service configuration.
OBSServiceConfiguration *conf = [[OBSServiceConfiguration alloc] initWithURLString:endPoint credentialProvider:credentialProvider];
// Initialize an instance of OBSClient.
client = [[OBSClient alloc] initWithConfiguration:conf];
// Obtain object properties.
OBSGetObjectMetaDataRequest *request = [[OBSGetObjectMetaDataRequest alloc]initWithBucketName:@"bucketname" objectKey:@"objectname"];
[client getObjectMetaData:request completionHandler:^(OBSGetObjectMetaDataResponse *response, NSError *error){
NSLog(@"meta:%@\n storageClass:%@\n websiteRedirectlocation:%@\n size:%@",response.metaDataDict,response.storageClass,response.websiteRedirectLocation,response.size);
}]; Last Article: Object Management
Next Article: Managing Object ACLs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.