DELETE Object

You can perform this operation to delete an object. OBS returns a success response even if the object to be deleted does not exist.

Versioning

If a bucket has versioning enabled, a deletion marker with a unique version ID is generated after attempting to delete an object in the bucket with no version ID specified. However, the object is not actually deleted.

If a bucket has versioning suspended, a deletion marker with version ID null is generated after an object in the bucket is deleted with no version ID specified. The object whose version is null (if such an object exists) is physically deleted.

You can specify versionId to delete an object of the specified version.

Request Syntax

DELETE /ObjectName HTTP/1.1
Host: bucketname.obs.cn-north-1.myhwclouds.com
Date: date
Authorization: authorization

Request parameters

Table 1 describes the request parameter.

Table 1 Request parameter

Parameter

Description

Required or Optional

versionId

Indicates the version ID of an object to be deleted.

Type: string

Optional

Request Headers

This request uses common headers. For details about common request headers, see Common Request Headers.

Request Elements

This request contains no element.

Response Syntax

HTTP/1.1 status_code
Date: date

Response Headers

This response uses common headers. For details about common response headers, see Table 2. In addition, this response also uses additional headers, as described in Table 2.

Table 2 Additional response headers

Header

Description

x-amz-delete-marker

Indicates whether an object is marked as deleted. If an object is not marked as deleted, the header is not returned.

Type: Boolean

Valid values: true or false

Default: false

x-amz-version-id

Indicates the version ID of an object. If an object has no version ID, this header is not returned.

Valid values: string

Default: none

Response Elements

This response contains no element.

Error Responses

No special error responses are returned. For details about error responses, see Table 1.

Example Request for Deleting an Object with a Deletion Marker from a Bucket with Versioning Enabled

DELETE /object HTTP/1.1
Host: bucketname.obs.cn-north-1.myhwclouds.com
Accept: */*
Date: Tue, 14 Jan 2014 06:16:51 +0000
Authorization: AWS C9590CEB8EC051BDEC9D:VlzVUv3z3WOuSyu2l8NzVsOXY0U=
Registration