• Object Storage Service

  1. Help Center
  2. Object Storage Service
  3. Developer Guide (PHP SDK)
  4. Object Download
  5. Downloading a Cold Object

Downloading a Cold Object

If you want to download a Cold object, you need to restore the object first. Three restore options are supported, as described in the following table.



Value on the OBS Server


Data can be restored within 1 to 5 minutes.



Data can be restored within 3 to 5 hours. This is the default option.



Data can be restored within 5 to 12 hours.


You can call ObsClient->restoreObject to restore a Cold object. Sample code is as follows:

// Import the third-party open source libraries.
require 'vendor/autoload.php';
// Import the SDK code library.
require 'obs-autoloader.php';
// Declare the namespace.
use Obs\S3\ObsClient;
// Create an instance of ObsClient.
$obsClient = new ObsClient ( [
       'key' => '*** Provide your Access Key ***',
       'secret' => '*** Provide your Secret Key ***',
       'endpoint' => 'https://yourdomainname'
] );

// Restore an object in the OBS Cold storage class.
$resp = $obsClient -> restoreObject([
       'Bucket' => 'bucketname',
       'Key' => 'objectkey',
       'Days' => 1,
       'Tier' => ObsClient::RestoreTierExpedited

printf("RequestId:%s\n", $resp['RequestId']);

// Wait until the object is restored.
sleep(6 * 60);

$resp = $obsClient -> getObject([
       'Bucket' => 'bucketname',
       'Key' => 'objectkey'

printf("RequestId:%s\n", $resp['RequestId']);
printf("Object Content:\n");
// Obtain the object content.
echo $resp ['Body'];
  • The object specified in ObsClient->restoreObject must be in the OBS Cold storage class. Otherwise, an error will be reported when you call this API.
  • Use the Days parameter to specify the retention period (from 1 to 30 days) of an object and the Tier parameter to specify the time spent on restoring the object.