Setting Object Properties
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.setObjectMetadata to set object properties, including custom metadata.
In addition to standard HTTP headers, you can also customize metadata. Custom metadata can contain only letters, digits, and hyphens (-).
Sample code is as follows:
String endPoint = "https://your-endpoint";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
// Create an ObsClient instance.
final ObsClient obsClient = new ObsClient(ak, sk, endPoint);
SetObjectMetadataRequest request = new SetObjectMetadataRequest("bucketname", "objectname");
// Standard HTTP headers of an object
request.setContentType("ContentType");
request.setExpires("Expires");
// Customize metadata.
request.addUserMetadata("property1", "property-value1");
ObjectMetadata metadata = obsClient.setObjectMetadata(request);
System.out.println("\t" + metadata.getUserMetadata("property1"));
Last Article: Object Management
Next Article: Obtaining Object Properties
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.