API Overview (SDK for Java)
Bucket APIs
Table 1 lists the bucket-related APIs.
|
API |
Method |
Function |
Source Code Example |
|---|---|---|---|
|
obsClient.createBucket(CreateBucketRequest request) |
Creates a bucket and configures the storage class, region, and ACL for the bucket. |
Submit a service ticket. |
|
|
obsClient.listBuckets(ListBucketsRequest request) |
Lists all buckets that meet the specified conditions under the current account and returns them in alphabetical order. |
Submit a service ticket. |
|
|
obsClient.deleteBucket(String bucketName) |
Deletes an empty bucket (the name of a deleted bucket can be reused at least 30 minutes after the deletion). |
Submit a service ticket. |
|
|
obsClient.headBucket(String bucketName) |
Checks whether a bucket exists (HTTP status code 200 indicates the bucket exists, while 404 indicates it does not). |
Submit a service ticket. |
|
|
obsClient.getBucketMetadata(BucketMetadataInfoRequest request) |
Returns information about a bucket, including the storage class, region, CORS rules, and redundancy policy. |
Submit a service ticket. |
|
|
obsClient.setBucketAcl(String bucketName,AccessControlList acl) |
Sets an ACL for a bucket. |
Submit a service ticket. |
|
|
obsClient.getBucketAcl(String bucketName) |
Returns the ACL of a bucket. |
Submit a service ticket. |
|
|
obsClient.setBucketPolicy(String bucketName, String policy) |
Sets a bucket policy. |
Submit a service ticket. |
|
|
obsClient.getBucketPolicy(String bucketName) |
Returns a bucket policy. |
Submit a service ticket. |
|
|
obsClient.deleteBucketPolicy(String bucketName) |
Deletes a bucket policy (204 No Content is returned if the policy is deleted successfully or actually does not exist). |
Submit a service ticket. |
|
|
obsClient.getBucketLocation(String bucketName) |
Returns the region where the bucket is created. |
Submit a service ticket. |
|
|
obsClient.getBucketStorageInfo(String bucketName) |
Returns the storage information about a bucket, including the storage usage and the object count in the bucket. |
Submit a service ticket. |
|
|
obsClient.setBucketQuota(String bucketName, BucketQuota bucketQuota) |
Sets a limit on the capacity of a bucket. |
Submit a service ticket. |
|
|
obsClient.getBucketQuota(String bucketName) |
Returns the quota of a bucket (0 indicates there is no upper limit to the capacity of the bucket). |
Submit a service ticket. |
|
|
obsClient.setBucketStoragePolicy(String bucketName, BucketStoragePolicyConfiguration bucketStorage) |
Specifies the storage class for a bucket (after the bucket storage class is configured, if you do not specifically configure the storage class for objects in that bucket, those objects will inherit the storage class of the bucket by default). |
Submit a service ticket. |
|
|
obsClient.getBucketStoragePolicy(String bucketName) |
Returns the storage class of a bucket. |
Submit a service ticket. |
|
|
obsClient.setInventoryConfiguration(SetInventoryConfigurationRequest request) |
Configures an inventory rule for a bucket (you can specify the object attributes to include in inventories, such as the object version, size, storage class, and last modification). |
Submit a service ticket. |
|
|
obsClient.getInventoryConfiguration(GetInventoryConfigurationRequest request) |
Returns a bucket inventory rule specified by the rule ID. |
Submit a service ticket. |
|
|
obsClient.listInventoryConfiguration(ListInventoryConfigurationRequest request) |
Returns all inventory rules of a bucket in a single response. |
Submit a service ticket. |
|
|
obsClient.deleteInventoryConfiguration(DeleteInventoryConfigurationRequest request) |
Deletes a bucket inventory rule specified by the rule ID. |
Submit a service ticket. |
Object APIs
Table 2lists object-related APIs.
|
API |
Method |
Function |
Source Code Example |
|---|---|---|---|
|
obsClient.putObject(PutObjectRequest request) |
Uploads local files of any type that are smaller than 5 GB to a bucket in streaming mode. |
Submit a service ticket. |
|
|
obsClient.putObject(PutObjectRequest request) |
Uploads local files of any type to a bucket over the Internet. |
- |
|
|
PutObjectRequest.setProgressListener(ProgressListener progressListener) |
Returns the progress of uploading an object. |
- |
|
|
obsClient.putObject(PutObjectRequest request) |
Creates a folder in a bucket to categorize the data. |
Submit a service ticket. |
|
|
obsClient.setObjectMetadata(SetObjectMetadataRequest request) |
Sets object attributes (such as the size, MIME type, MD5 value, storage class, or user-defined metadata) when uploading an object in streaming, file-based, or multipart mode, or when copying an object. |
Submit a service ticket. |
|
|
obsClient.initiateMultipartUpload(InitiateMultipartUploadRequest request) |
Initiates a multipart upload and returns a globally unique upload ID. |
Submit a service ticket. |
|
|
obsClient.uploadPart(UploadPartRequest request) |
Uploads parts to the bucket based on the upload ID returned by the preceding API. |
Submit a service ticket. |
|
|
obsClient.completeMultipartUpload(CompleteMultipartUploadRequest request) |
Completes a multipart upload based on the multipart upload ID and information about the uploaded parts (including PartNumber and ETag). |
Submit a service ticket. |
|
|
obsClient.abortMultipartUpload(AbortMultipartUploadRequest request) |
Aborts a multipart upload specified by the upload ID in a bucket. |
- |
|
|
obsClient.listParts(ListPartsRequest request) |
Returns the uploaded parts in a bucket based on the specified multipart upload ID. |
Submit a service ticket. |
|
|
obsClient.listMultipartUploads(ListMultipartUploadsRequest request) |
Lists ongoing multipart uploads. |
- |
|
|
obsClient.putObject(PutObjectRequest request) |
Configures a lifecycle rule for objects to periodically delete objects in the bucket or transition object storage classes (the object expiration time set using this API takes precedence over that set in a bucket lifecycle rule). |
- |
|
|
obsClient.appendObject(AppendObjectRequest request) |
Appends content to an existing object. |
- |
|
|
obsClient.uploadFile(UploadFileRequest request) |
Provides the resumable function based on the API for multipart uploads to better respond to network disconnections or program crashes. |
- |
|
|
obsClient.createPostSignature(PostSignatureRequest request) |
Uploads an object up to 5 GB in size to a bucket in the HTML form. |
Submit a service ticket. |
|
|
obsClient.getObject(GetObjectRequest request) |
Downloads an object from OBS to a local directory or memory (the returned results contain the object name, attributes, input stream, and bucket information). |
Submit a service ticket. |
|
|
obsClient.getObject(GetObjectRequest request) |
Downloads the partial data of an object. |
- |
|
|
GetObjectRequest.setProgressListener(ProgressListener progressListener) |
Returns the progress of downloading an object. |
- |
|
|
obsClient.getObject(GetObjectRequest request) |
Returns the objects that meet one or more specified conditions. |
- |
|
|
obsClient.getObject(GetObjectRequest request) |
Rewrites the following HTTP/HTTPS response headers when downloading an object: Content-Type, Content-Language, Expires, Cache-Control, Content-Disposition, and Content-Encoding. |
- |
|
|
obsClient.getObject(GetObjectRequest request) |
Returns the user-defined object metadata after the object is successfully downloaded. |
Submit a service ticket. |
|
|
obsClient.restoreObject(RestoreObjectRequest request) |
Restores and downloads a Cold object. |
Submit a service ticket. |
|
|
obsClient.downloadFile(DownloadFileRequest request) |
Adds the resumable function to the partial download API. |
- |
|
|
obsClient.setObjectMetadata(SetObjectMetadataRequest request) |
Configures the object metadata. |
- |
|
|
obsClient.getObjectMetadata(GetObjectMetadataRequest request) |
Returns the object metadata. |
- |
|
|
obsClient.setObjectAcl(SetObjectAclRequest request) |
Sets an ACL for an object when uploading the object or modifies the ACL of an existing object by calling an ACL API. |
Submit a service ticket. |
|
|
obsClient.getObjectAcl(GetObjectAclRequest request) |
Obtains the ACL of an object in a specified bucket. |
Submit a service ticket. |
|
|
obsClient.listObjects(ListObjectsRequest request) |
Lists some or all objects in a bucket based on the specified prefix, object count, and start position and returns the objects in alphabetical order. |
Submit a service ticket. |
|
|
obsClient.deleteObject(DeleteObjectRequest request) |
Deletes an object from a bucket. |
Submit a service ticket. |
|
|
obsClient.deleteObjects(DeleteObjectsRequest deleteRequest) |
Deletes objects from a bucket in a batch. (Deleted objects cannot be restored.) |
Submit a service ticket. |
|
|
obsClient.copyObject(CopyObjectRequest request) |
Creates a copy up to 5 GB for an object. |
Submit a service ticket. |
|
|
obsClient.copyPart(CopyPartRequest request) |
Copies parts to a specified bucket based on the multipart upload ID returned in initiating a multipart upload. |
Submit a service ticket. |
|
|
doesObjectExist(final GetObjectMetadataRequest request) |
Checks whether an object exists (HTTP status code 200 indicates the object exists, while 404 indicates the object or bucket does not exist). |
- |
Temporarily Authorized Access APIs
Table 3 lists the APIs related to temporarily authorized access.
|
API |
Method |
Function |
Source Code Example |
|---|---|---|---|
|
obsClient.createTemporarySignature(TemporarySignatureRequest request) |
Creates a signed URL and specifies the expiration time for the URL to grant visitors temporary access. (To allow other users to perform a temporary operation such as upload, you need to generate a URL for the corresponding operation and offer that to users.) |
Submit a service ticket. |
Versioning APIs
Table 4 lists the APIs related to versioning.
|
API |
Method |
Function |
Source Code Example |
|---|---|---|---|
|
obsClient.setBucketVersioning(final SetBucketVersioningRequest request) |
Configures versioning for objects in a bucket. |
Submit a service ticket. |
|
|
obsClient.getBucketVersioning(final BaseBucketRequest request) |
Returns the versioning status of a bucket. |
Submit a service ticket. |
|
|
obsClient.getObject(GetObjectRequest request) |
Returns a specified object version. |
- |
|
|
obsClient.copyObject(CopyObjectRequest request) |
Creates a copy up to 5 GB for a versioned object. |
- |
|
|
obsClient.restoreObject(RestoreObjectRequest request) |
Restores a Cold object version. (To download a Cold object version, you need to restore it first.) |
- |
|
|
obsClient.listVersions(ListVersionsRequest request) |
Lists some or all object versions in a bucket based on the specified prefix, version count, and start position and returns the versions in alphabetical order. |
Submit a service ticket. |
|
|
obsClient.setObjectAcl(SetObjectAclRequest request) |
Sets an ACL for an object version. |
- |
|
|
obsClient.getObjectAcl(GetObjectAclRequest request) |
Returns the ACL of an object version. |
- |
|
|
obsClient.deleteObject(DeleteObjectRequest request) |
Deletes the ACL of an object version. |
- |
|
|
obsClient.deleteObjects(DeleteObjectsRequest deleteRequest) |
Deletes object versions from a bucket in a batch. (Deleted object versions cannot be restored.) |
Submit a service ticket. |
Lifecycle Rule APIs
Table 5 lists the APIs related to lifecycle rules.
|
API |
Method |
Function |
Source Code Example |
|---|---|---|---|
|
obsClient.setBucketLifecycle(final SetBucketLifecycleRequest request) |
Sets a lifecycle rule for a bucket to periodically delete objects in the bucket or transition object storage classes. |
Submit a service ticket. |
|
|
obsClient.getBucketLifecycle(final BaseBucketRequest request) |
Returns a lifecycle rule of a bucket. |
Submit a service ticket. |
|
|
obsClient.deleteBucketLifecycle(final BaseBucketRequest request) |
Deletes a lifecycle rule of a bucket. |
Submit a service ticket. |
CORS rule APIs
Table 6 lists the APIs related to CORS rules.
|
API |
Method |
Function |
Source Code Example |
|---|---|---|---|
|
obsclient.setBucketCors(final SetBucketCorsRequest request) |
Sets a CORS rule for a bucket (the existing rules will be overwritten by the new ones). |
Submit a service ticket. |
|
|
obsclient.getBucketCors(final BaseBucketRequest request) |
Returns a CORS rule of a bucket. |
Submit a service ticket. |
|
|
obsclient.deleteBucketCors(final BaseBucketRequest request) |
Deletes a CORS rule of a bucket. |
Submit a service ticket. |
Bucket Logging APIs
Table 7 lists the logging APIs.
|
API |
Method |
Function |
Source Code Example |
|---|---|---|---|
|
obsClient.setBucketLogging(final SetBucketLoggingRequest request) |
Enables logging for a source bucket, specifies a target bucket for storing log files, and configures the name prefixes and access permissions for log files. |
Submit a service ticket. |
|
|
Obtaining the Logging Configuration of a Bucket (SDK for Java) |
obsClient.getBucketLogging(final BaseBucketRequest request) |
Returns the logging configuration of a bucket. |
Submit a service ticket. |
Static Website Hosting APIs
Table 8 lists the APIs related to static website hosting.
|
API |
Method |
Function |
Source Code Example |
|---|---|---|---|
|
Uploads the files of a static website to a specified bucket in OBS, configures the public read permission for the files, and enables static website hosting for the bucket. |
- |
|
|
obsClient.setBucketWebsite(final SetBucketWebsiteRequest request) |
Configures website hosting for a bucket. |
Submit a service ticket. |
|
|
Obtaining Static Website Hosting Configurations (SDK for Java) |
obsClient.getBucketWebsite(final BaseBucketRequest request) |
Returns the website configuration of a bucket. |
Submit a service ticket. |
|
Deleting Static Website Hosting Configurations (SDK for Java) |
obsClient.deleteBucketWebsite(final BaseBucketRequest request) |
Deletes the website configuration of a bucket. |
Submit a service ticket. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot