Updated on 2022-02-10 GMT+08:00

POST Object restore

API Description

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

Method Definition

1. ObsClient->restoreObject(array $parameter)
2. ObsClient->restoreObjectAsync(array $parameter, callable $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 Archive storage class

Days

integer

Mandatory

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

Tier

string

Optional

Restore option

Returned Result

Field

Type

Description

HttpStatusCode

integer

HTTP status code

Reason

string

Reason description

RequestId

string

Request ID returned by the OBS server

Sample Code

try {
       $resp = $obsClient->restoreObject( [ 
              'Bucket' => 'bucketname',
              'Key' => 'objectkey',
              'Days' => 1,
              'Tier' => ObsClient::RestoreTierExpedited
       ] );
       printf ( "RequestId:%s\n", $resp ['RequestId'] );
} catch ( Obs\Common\ObsException $obsException ) {
       printf ( "ExceptionCode:%s\n", $obsException->getExceptionCode () );
       printf ( "ExceptionMessage:%s\n", $obsException->getExceptionMessage () );
}