Updated on 2023-03-16 GMT+08:00

Restore an Archive Object

API Description

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

Method Definition

ObsClient.restoreObject

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 Archive 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

Returned Result (InterfaceResult)

Field

Type

Description

RequestId

String

Request ID returned by the OBS server

RestoreStatus

String

Restore status of the object. AVAILABLE 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);
              }
       }
});