• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (PHP 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

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 Cold 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. Possible values are:

  • ObsClient::RestoreTierExpedited: Data can be restored within 1 to 5 minutes.
  • ObsClient::RestoreTierStandard: Data can be restored within 3 to 5 hours.
  • ObsClient::RestoreTierBulk: Data can be restored within 5 to 12 hours.

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 () );
}