Deleting an Object

You can delete one or more objects from the OBS system. You can delete either an object or multiple objects at once.

  • Deleting an object: Use the deletion API to delete an object in an HTTP request.
  • Deleting multiple objects: Use the batch deletion API to delete up to 100 objects in an HTTP request.

To delete an object from a bucket with versioning disabled, you need to specify the object name only. To delete an object in a specific version from a bucket with versioning enabled, you need to specify the version ID as well as the name of the object.

Deleting an object from a bucket with versioning enabled

If versioning is enabled for a bucket, an object in the bucket may have multiple versions. For such a bucket, the following options are provided by the object deletion API:

  • A deletion request without specifying the version ID: The object name is specified but not the version ID.

    In this case, OBS only deletes the latest version of the object from the bucket. For a deleted version, OBS creates a Delete Marker for it and returns a new version ID. When an object of the latest version is listed, it cannot be queried because of its Delete Marker.

  • A deletion request with the version ID specified: The object name is specified, as well as the version ID. In this case, either of the following results may occur:
    1. If the version ID is mapped to a specific object version, OBS deletes the object of that version.
    2. If the version ID maps to an object delete mark, OBS deletes this delete mark. After this operation, the object will reappear in the bucket.

    If you want to make an API call to delete objects in the deleted object list, you need to make an API call to list objects that have multiple versions, and then specify the version IDs that you want to delete.

For more information, see section Deleting an Object in the Object Storage Service API Reference.