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 |
For the parameters and method descriptions of all the APIs in the SDK, please see SDK API Reference.
This API is used to restore an archived object for access.
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?