Restores an object of the Archive storage class.

Versioning

The storage class of each version of an object can be different. RestoreObject restores the current version of the target object by default. You can specify the versionId in the request to restore the specified version of the object.

Note
  • RestoreObject only applies to objects of the Archive storage class but not those of the Standard and IA storage classes.
  • A 202 status code is returned if you call RestoreObject to restore an object for the first time.
  • If you have restored an object by calling RestoreObject, a 200 OK message is returned if you call the API again.

Restore process

An object of the Archive storage class is restored as follows:
  1. The object is in the frozen status.
  2. After you initiate a restore request, the object is in the restoring state. It generally takes 1 minute for the object to be restored. However, the maximum time period required to restore an object is 4 hours.
  3. After the restore tasks is finished, the object is in the restored state for 24 hours by default. During this period, you can read the object. If you call RestoreObject again during this period, the restore state of the object prolongs for 24 hours. The restored period can be prolonged to a maximum of 7 days.
  4. After the restored period, the object returns to the frozen state.

Billing methods

The following fees are incurred when the status of an object is changed:

  • Data retrieval fees are incurred if you restore an archived object.
  • The restored state of an object can be prolonged to a maximum of seven days. No fees are incurred during this period.
  • After a restored object returns to the frozen state, data retrieval fees are incurred if you restore it again.

Request syntax

POST /ObjectName?restore HTTP/1.1
Host: archive-bucket.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Examples

  • Example of request initiated to restore a archived object for the first time:
    POST /oss.jpg?restore HTTP/1.1
    Host: oss-archive-example.oss-cn-hangzhou.aliyuncs.com
    Date: Sat, 15 Apr 2017 07:45:28 GMT
    Authorization: OSS e1Unnbm1rgdnpI:y4eyu+4yje5ioRCr****

    Response example

    HTTP/1.1 202 Accepted
    Date: Sat, 15 Apr 2017 07:45:28 GMT
    Content-Length: 0
    Connection: keep-alive
    Server: AliyunOSS
    x-oss-request-id: 5374A2880232A65C23002D74
  • Example of a request initiated to restore an object being restored:
    POST /oss.jpg?restore HTTP/1.1
    Host: oss-archive-example.oss-cn-hangzhou.aliyuncs.com
    Date: Sat, 15 Apr 2017 07:45:29 GMT
    Authorization: OSS e1Unnbm1rgdnpI:21qtGJ+ykDVmdy4eyu+N****

    Response example

    HTTP/1.1 409 Conflict
    Date: Sat, 15 Apr 2017 07:45:29 GMT
    Content-Length: 556
    Connection: keep-alive
    Server: AliyunOSS
    x-oss-request-id: 5374A2880232A65C23002D74
    <?xml version="1.0" encoding="UTF-8"?>
    <Error>
      <Code>RestoreAlreadyInProgress</Code>
      <Message>The restore operation is in progress.</Message>
      <RequestId>58EAF141461FB42C2B000008</RequestId>
      <HostId>10.101.200.***</HostId>
    </Error>
  • Example of a request initiated to restore a restored object:
    POST /oss.jpg?restore HTTP/1.1
    Host: oss-archive-example.oss-cn-hangzhou.aliyuncs.com
    Date: Sat, 15 Apr 2017 07:45:29 GMT
    Authorization: OSS e1Unnbm1rgdnpI:u6O6FMJnn+WuBwbByZxm1+y4eyu+N****

    Response example

    HTTP/1.1 200 Ok
    Date: Sat, 15 Apr 2017 07:45:30 GMT
    Content-Length: 0
    Connection: keep-alive
    Server: AliyunOSS
    x-oss-request-id: 5374A2880232A65C23002D74
  • Example of a request initiated with a specified versionId to restore the specified version of an object:
    POST /oss.jpg?restore&versionId=CAEQNRiBgMClj7qD0BYiIDQ5Y2QyMjc3NGZkODRlMTU5M2VkY2U3MWRiNGRh**** HTTP/1.1
    Host: oss-archive-example.oss-cn-hangzhou.aliyuncs.com
    Date: Tue, 09 Apr 2019 06:50:48 GMT
    Authorization: OSS o3shiyktjw16xw1:2JND5qqlAlaA1/kLO4kBbGTw****

    Response example

    HTTP/1.1 202 Accepted
    Date: Tue, 09 Apr 2019 06:50:48 GMT
    Content-Length: 0
    Connection: keep-alive
    Server: AliyunOSS
    x-oss-version-id: CAEQNRiBgMClj7qD0BYiIDQ5Y2QyMjc3NGZkODRlMTU5M2VkY2U3MWRiNGRh****
    x-oss-request-id: 5CAC40C8B7AEADE017000653

SDK

The SDKs of this API are as follows:

Error codes

Error code HTTP status code Description
NoSuchKey 404 The requested object does not exist.
OperationNotSupported 400 The storage class of the requested object is not Archive.
RestoreAlreadyInProgress 409 You have called RestoreObject successfully and the object is being restored. Do not initiate RestoreObject requests repeatedly.