Downloading an Archive Object

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference

If you want to download an object in this storage class, you need to restore the object first. Two restore options are supported, as described in the following table.

Option

Description

Value in OBS .NET SDK

Expedited

Data can be restored within 1 to 5 minutes.

RestoreTierEnum.Expedited

Standard

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

RestoreTierEnum.Standard

You can call ObsClient.RestoreObject to restore Archive objects. Sample code is as follows:

// Create an instance of ObsClient.
ObsClient client = new ObsClient("*** Provide your Access Key ***", "*** Provide your Secret Key ***", "https://your-endpoint");

try
{
    RestoreObjectRequest request = new RestoreObjectRequest();
    request.BucketName = "bucketname";
    request.ObjectKey = "objectname";
    request.Days = 5;
    request.Tier = RestoreTierEnum.Expedited;
    request.VersionId = "versionId";
    RestoreObjectResponse response = client.RestoreObject(request);
    Console.WriteLine("Restore object response: {0}", response.StatusCode);
}
catch (ObsException ex)
{
   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
}
  • The object specified in ObsClient.RestoreObject must be in the OBS Archive storage class. Otherwise, an exception will be thrown when you call this API.
  • RestoreObjectRequest.Days specifies the retention period of restored object, ranging from 1 to 30.
  • RestoreObjectRequest.Tier specifies the restore option, which indicates the time spend on restoring an object.