All Products
Search
Document Center

Object Storage Service:InitiateBucketWorm

Last Updated:Jul 17, 2024

Creates a retention policy.

Usage notes

Object Storage Service (OSS) supports the Write Once Read Many (WORM) feature that prevents an object from being deleted or overwritten for a specific period of time. You can configure a time-based retention policy for buckets. This policy has a protection period ranging from 1 day to 70 years.

  • If a retention policy is not locked within 24 hours after it is created, the retention policy becomes invalid. After a retention policy configured for a bucket is locked, you can read objects from or upload objects to the bucket. You cannot delete the retention policy or objects in the bucket within the retention period. You can delete the objects only after the retention period expires. For more information about retention policies, see Retention policies.

  • You cannot enable versioning and configure retention policies for a bucket at the same time. If versioning is enabled for a bucket, you cannot configure retention policies for the bucket. For more information about versioning, see Overview.

Request elements

Element

Type

Required

Description

InitiateWormConfiguration

Container

Yes

The root node.

Child nodes: RetentionPeriodInDays

RetentionPeriodInDays

Positive integer

Yes

The number of days for which objects in the bucket can be retained.

Examples

  • Sample requests

    POST /?worm HTTP/1.1
    Date: Thu, 15 May 2014 11:18:32 GMT
    Content-Length: 556
    Content-Type: application/xml
    Host: BucketName.oss.aliyuncs.com
    Authorization: OSS qn6q**************:77Dv****************
    
    <InitiateWormConfiguration>
      <RetentionPeriodInDays>365</RetentionPeriodInDays>
    </InitiateWormConfiguration>
  • Sample success responses

    HTTP/1.1 200 OK
    x-oss-request-id: 5374A2880232A65C2300****
    x-oss-worm-id: 1666E2CFB2B3418****
    Date: Thu, 15 May 2014 11:18:32 GMT