• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (Node.js SDK)
  4. Objects-Related APIs
  5. POST Object Restore

POST Object Restore

API Description

You can use this API to restore an object in the OBS Cold storage class in a specified bucket.

Method Definition

ObsClient.restoreObject(parameter, callback)

Request Parameter

Field

Type

Optional or Mandatory

Description

Bucket

String

Mandatory

Bucket name

Key

String

Mandatory

Object name

VersionId

String

Optional

Version ID of the to-be-restored object in the OBS Cold storage class

Days

Number

Mandatory

Retention period of the restored object, in days. The value ranges from 1 to 30.

Tier

String

Optional

Restore option. Possible values are:

  • ObsClient.enums.RestoreTierExpedited: Data can be restored within 1 to 5 minutes.
  • ObsClient.enums.RestoreTierStandard: Data can be restored within 3 to 5 hours. This is the default option.
  • ObsClient.enums.RestoreTierBulk: Data can be restored within 5 to 12 hours.

Returned Result (InterfaceResult)

Field

Type

Description

RequestId

String

Request ID returned by the OBS server

RestoreStatus

String

Restoration status of the object. AVALIABLE indicates that the object can be downloaded. INPROGRESS indicates that the object is being restored.

Sample Code

obsClient.restoreObject({
       Bucket:'bucketname',
       Key : 'objectkey',
       Days : 1,   
       Tier : obsClient.enums.RestoreTierExpedited
},(err, result) => {
       if(err){
              console.error('Error-->' + err);
       }else{
              if(result.CommonMsg.Status < 300){
                     console.log('RequestId-->' + result.InterfaceResult.RequestId);
                     console.log('RestoreStatus-->' + result.InterfaceResult.RestoreStatus);
              }else{
                     console.log('Code-->' + result.CommonMsg.Code);
                     console.log('Message-->' + result.CommonMsg.Message);
              }
       }
});