Restoring an Archived Object

Last updated: 2020-08-18 10:55:28

    Overview

    This document provides an overview of APIs and SDK code samples related to restoring an archived object.

    API Operation Name Description
    POST Object restore Restoring an archived object Restores archived object for access

    SDK API Reference

    For the parameters and method descriptions of all the APIs in the SDK, please see SDK API Reference.

    Restoring an Archived Object

    Feature description

    This API is used to restore an archived object for access.

    Sample code

    String bucket = "examplebucket-1250000000"; // Format: BucketName-APPID
    String cosPath = "exampleobject"; // Location identifier of the object in the bucket, i.e., the object key
    RestoreRequest restoreRequest = new RestoreRequest(bucket, cosPath);
    restoreRequest.setExpireDays(5); // Retain for 5 days
    restoreRequest.setTier(RestoreConfigure.Tier.Standard); // Standard restoration mode
    
    cosXmlService.restoreObjectAsync(restoreRequest, new CosXmlResultListener() {
        @Override
        public void onSuccess(CosXmlRequest request, CosXmlResult result) {
            RestoreResult restoreResult = (RestoreResult) result;
        }
    
        @Override
        public void onFail(CosXmlRequest cosXmlRequest,
                           CosXmlClientException clientException,
                           CosXmlServiceException serviceException) {
            if (clientException != null) {
                clientException.printStackTrace();
            } else {
                serviceException.printStackTrace();
            }
        }
    });

    Note:

    For more samples, please visit GitHub.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help