Updated on 2023-06-15 GMT+08:00

Restoring Archive Objects

API Description

You can use this API to restore an Archive object 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

RequestDate

String

or

Date

Optional

Request time

NOTE:

When the parameter type is String, the value must comply with the ISO8601 or RFC822 standards.

VersionId

String

Optional

Version ID of the to-be-restored Archive object

Days

Number

Mandatory

Retention period of the restored object, in days. The value is 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
},function (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);
              }
       }
});