Objects that are stored in Object Storage Service (OSS) consist of keys, data, and object metadata. Object metadata describes the object. Object metadata includes standard HTTP headers and user metadata. You can create custom HTTP request policies such as object cache policies and forced object download policies by configuring standard HTTP headers. You can configure user metadata for an object to identify the purposes or attributes of the object.
Usage notes
In this topic, the public endpoint of the China (Hangzhou) region is used. If you want to access OSS from other Alibaba Cloud services in the same region as OSS, use an internal endpoint. For more information about OSS regions and endpoints, see Regions and endpoints.
In this topic, access credentials are obtained from environment variables. For more information about how to configure access credentials, see Configure access credentials.
In this topic, an OSSClient instance is created by using an OSS endpoint. If you want to create an OSSClient instance by using custom domain names or Security Token Service (STS), see Configure OSSClient instances.
To configure object metadata, you must have the
oss:PutObjectpermission. To query object metadata, you must have theoss:GetObjectpermission. For more information, see Attach a custom policy to a RAM user.
Sample code
FAQ
How do I prevent an object from being overwritten by an object with the same name?
References
For the complete sample code for object metadata, see the GitHub example.
For more information about the API operation used to set object metadata during a simple upload, see PutObject.
For more information about the API operation used to modify the metadata of an existing object, see CopyObject.
For more information about the API operation used to retrieve object metadata, see GetObjectMeta.