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 access permissions for the bucket. |
||
obsClient.listBuckets(ListBucketsRequest request) |
Lists all buckets that meet the specified conditions under the current account and returns them in alphabetical order. |
||
obsClient.deleteBucket(String bucketName) |
Deletes an empty bucket (the name of a deleted bucket can be reused at least 30 minutes after the deletion). |
||
obsClient.headBucket(String bucketName) |
Checks whether a bucket exists (HTTP status code 200 indicates the bucket exists, while 404 indicates it does not). |
||
obsClient.getBucketMetadata(BucketMetadataInfoRequest request) |
Returns information about a bucket, including the storage class, region, CORS rules, and redundancy policy. |
||
obsClient.setBucketAcl(String bucketName,AccessControlList acl) |
Sets an ACL for a bucket. |
||
obsClient.getBucketAcl(String bucketName) |
Returns the ACL of a bucket. |
||
obsClient.setBucketPolicy(String bucketName, String policy) |
Sets a bucket policy. |
||
obsClient.getBucketPolicy(String bucketName) |
Returns a bucket policy. |
||
obsClient.deleteBucketPolicy(String bucketName) |
Deletes a bucket policy (204 No Content is returned if the policy is deleted successfully or actually does not exist). |
||
obsClient.getBucketLocation(String bucketName) |
Returns the region where the bucket is created. |
||
obsClient.getBucketStorageInfo(String bucketName) |
Returns the storage information about a bucket, including the storage usage and the object count in the bucket. |
||
obsClient.setBucketQuota(String bucketName, BucketQuota bucketQuota) |
Sets a limit on the capacity of a bucket. |
||
obsClient.getBucketQuota(String bucketName) |
Returns the quota of a bucket (0 indicates there is no upper limit to the capacity of the bucket). |
||
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). |
||
obsClient.getBucketStoragePolicy(String bucketName) |
Returns the storage class of a bucket. |
||
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, tag, encryption status, and last modification). |
||
obsClient.getInventoryConfiguration(GetInventoryConfigurationRequest request) |
Returns a bucket inventory rule specified by the rule ID. |
||
obsClient.listInventoryConfiguration(ListInventoryConfigurationRequest request) |
Returns all inventory rules of a bucket in a single response. |
||
obsClient.deleteInventoryConfiguration(DeleteInventoryConfigurationRequest request) |
Deletes a bucket inventory rule specified by the rule ID. |
Parallel File System APIs
Table 2 lists the APIs related to the parallel file system (PFS).
API |
Method |
Function |
---|---|---|
obsClient.createBucket(CreateBucketRequest request) |
Creates a PFS and configures the region and access permissions for the PFS. |
|
obsClient.listBuckets(ListBucketsRequest request) |
Lists all PFSs that meet the specified conditions under the current account and returns them in alphabetical order. |
|
obsClient.listObjects(final ListObjectsRequest request) |
Lists the objects in a PFS. |
|
obsClient.modifyObject(ModifyObjectRequest request) |
Modifies the content of a file from a specific position. |
|
obsClient.renameObject(RenameObjectRequest request) |
Renames the file in a PFS. |
|
obsClient.truncateObject(TruncateObjectRequest request) |
Reduces the size of a file. |
Object APIs
Table 3lists 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. |
||
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. |
||
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. |
||
obsClient.initiateMultipartUpload(InitiateMultipartUploadRequest request) |
Initiates a multipart upload and returns a globally unique upload ID. |
||
obsClient.uploadPart(UploadPartRequest request) |
Uploads parts to the bucket based on the upload ID returned by the preceding API. |
||
obsClient.completeMultipartUpload(CompleteMultipartUploadRequest request) |
Completes a multipart upload based on the multipart upload ID and information about the uploaded parts (including PartNumber and ETag). |
||
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. |
||
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. |
||
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). |
||
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. |
||
obsClient.restoreObject(RestoreObjectRequest request) |
Restores and downloads an Archive object. |
||
obsClient.downloadFile(DownloadFileRequest request) |
Adds the resumable function to the partial download API. |
- |
|
obsClient.getObject(GetObjectRequest request) |
Crops, re-sizes, or watermarks an image, or converts the image format before the download. |
- |
|
Creating a Signed URL for Downloading a Processed Image (SDK for Java) |
obsClient.createTemporarySignature(TemporarySignatureRequest request) |
Creates a signed URL for downloading a processed image. |
- |
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. |
||
obsClient.getObjectAcl(GetObjectAclRequest request) |
Obtains the ACL of an object in a specified bucket. |
||
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. |
||
obsClient.deleteObject(DeleteObjectRequest request) |
Deletes an object from a bucket. |
||
obsClient.deleteObjects(DeleteObjectsRequest deleteRequest) |
Deletes objects from a bucket in a batch. (Deleted objects cannot be restored.) |
||
obsClient.copyObject(CopyObjectRequest request) |
Creates a copy up to 5 GB for an object. |
||
obsClient.copyPart(CopyPartRequest request) |
Copies parts to a specified bucket based on the multipart upload ID returned in initiating a multipart upload. |
||
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 4 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.) |
Versioning APIs
Table 5 lists the APIs related to versioning.
API |
Method |
Function |
Source Code Example |
---|---|---|---|
obsClient.setBucketVersioning(final SetBucketVersioningRequest request) |
Configures versioning for objects in a bucket. |
||
obsClient.getBucketVersioning(final BaseBucketRequest request) |
Returns the versioning status of a bucket. |
||
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 an Archive object version. (To download an Archive 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. |
||
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.) |
Lifecycle Rule APIs
Table 6 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. |
||
obsClient.getBucketLifecycle(final BaseBucketRequest request) |
Returns a lifecycle rule of a bucket. |
||
obsClient.deleteBucketLifecycle(final BaseBucketRequest request) |
Deletes a lifecycle rule of a bucket. |
CORS rule APIs
Table 7 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). |
||
obsclient.getBucketCors(final BaseBucketRequest request) |
Returns a CORS rule of a bucket. |
||
obsclient.deleteBucketCors(final BaseBucketRequest request) |
Deletes a CORS rule of a bucket. |
Bucket Logging APIs
Table 8 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. |
||
Obtaining the Logging Configuration of a Bucket (SDK for Java) |
obsClient.getBucketLogging(final BaseBucketRequest request) |
Returns the logging configuration of a bucket. |
Static Website Hosting APIs
Table 9 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. |
||
Obtaining Static Website Hosting Configurations (SDK for Java) |
obsClient.getBucketWebsite(final BaseBucketRequest request) |
Returns the website configuration of a bucket. |
|
Deleting Static Website Hosting Configurations (SDK for Java) |
obsClient.deleteBucketWebsite(final BaseBucketRequest request) |
Deletes the website configuration of a bucket. |
Tagging APIs
Table 10 lists the APIs related to tagging.
API |
Method |
Function |
Source Code Example |
---|---|---|---|
obsClient.setBucketTagging(final SetBucketTaggingRequest request) |
Tags a bucket to facilitate CDR filtering and cost analysis. |
||
obsClient.getBucketTagging(final BaseBucketRequest request) |
Returns the tags of a bucket. |
||
obsClient.deleteBucketTagging(final BaseBucketRequest request) |
Deletes the tags of a bucket. |
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