• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (OBS)
  4. Operations on Buckets
  5. PUT Bucket versioning

PUT Bucket versioning

You can use this operation to enable or suspend versioning for a bucket.

Versioning can be used to restore an object that is incorrectly overwritten or deleted. You can use versioning to save, query, and restore objects of different versions. Versioning allows you to easily recover data lost due to misoperations or program faults. Versioning can also be used for retaining and archiving data.

By default, versioning is disabled for a bucket.

After the versioning state is set to Enabled:

  • OBS creates a unique version ID for each uploaded object. Namesake objects are not overwritten and are distinguished by their own version IDs.
  • Objects can be downloaded by version ID. By default, the latest object is downloaded if the version ID is not specified.
  • Objects can be deleted by version ID. If an object is deleted with no version ID specified, the object is only attached with a deletion mark and a unique version ID but is not physically deleted.
  • The latest objects in a bucket are returned by default after a GET Object request. You can also send a request to obtain a bucket's objects with all version IDs.
  • Except deletion marks and object metadata, storage space occupied by objects with all version IDs is billed.

After the versioning state is set to Suspended:

  • Existing objects with version IDs are not affected.
  • OBS creates version ID null to an uploaded object and the object will be overwritten after a namesake one is uploaded.
  • Objects can be downloaded by version ID. By default, the latest object is downloaded if the version ID is not specified.
  • Objects can be deleted by version ID. If an object is deleted with no version ID specified, the object is only attached with a deletion mark and version ID null. Objects with version ID null are physically deleted.
  • Except deletion marks and object metadata, storage space occupied by objects with all version IDs is billed.

Only the bucket owner can set the bucket versioning state.