Restoring an Archive Object
API Description
You can use this API to restore an object from the OBS Archive storage class in a specified bucket.
Method Definition
ObsClient.restoreObject(bucketName, objectKey, days, tier, versionId)
Request Parameters
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
bucketName |
str |
Mandatory |
Bucket name |
|
objectKey |
str |
Mandatory |
Object name |
|
days |
int |
Mandatory |
Retention period of the restored object, in days. The value ranges from 1 to 30. |
|
tier |
str |
Optional |
|
|
versionId |
str |
Optional |
Version ID of the to-be-restored object from the OBS Archive storage class |
Returned Results
|
Type |
Description |
|---|---|
|
SDK common result object |
If GetResult.status is 202, the object is being restored. If GetResult.status is 200, the object has been restored.
Sample Code
from obs import RestoreTier
try:
resp = obsClient.restoreObject('bucketname', 'objectkey', 1, RestoreTier.EXPEDITED)
if resp.status < 300:
print('requestId:', resp.requestId)
else:
print('errorCode:', resp.errorCode)
print('errorMessage:', resp.errorMessage)
except:
import traceback
print(traceback.format_exc())
Last Article: Obtaining Object ACL Information
Next Article: APIs Related to Multipart Upload
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.