• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Java SDK)
  4. Versioning Management
  5. Restoring a Versioning Cold Object

Restoring a Versioning Cold Object

You can call ObsClient.restoreObject to restore a versioning Cold object by specifying the version ID (versionId). Sample code is as follows:

String endPoint = "yourdomainname";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
// Create an instance of ObsClient.
ObsClient obsClient = new ObsClient(ak, sk, endPoint);

RestoreObjectRequest request = new RestoreObjectRequest("bucketname", "objectkey", 1);
request.setVersionId("versionid");
obsClient.restoreObject(request);

// Close obsClient.
obsClient.close();