doc-exports/docs/obs/api-ref/obs_04_0085.html
Jawei, Li f1cb839979 OBS api-ref 2.0.38.SP5
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Jawei, Li <lijiawei5@huawei.com>
Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
2022-11-03 11:54:51 +00:00

8.9 KiB

Deleting an Object

Functions

You can perform this operation to delete an object. If you try to delete an object that does not exist, OBS will return a success message.

Versioning

When versioning is enabled for a bucket, a deletion marker with a unique version number is generated when an object is deleted without specifying the version. However, the object is not actually deleted. If versioning is suspended for a bucket and no version is specified when you delete an object, the object whose version number is null is deleted, and a deletion marker with version number null is generated.

To delete an object of a specified version, the versionId parameter can be used to specify the desired version.

Request Syntax

1
2
3
4
DELETE /ObjectName HTTP/1.1 
Host: bucketname.obs.region.example.com
Date: date
Authorization: authorization

Request Parameters

Table 1 describes the request parameters.

For deleting an object, only parameters listed in Table 1 are supported. If the request contains parameters that cannot be identified by OBS, the server returns the 400 error code.

Table 1 Request parameters

Parameter

Description

Mandatory

versionId

Object version ID

Type: string

No

Request Headers

This request uses common headers. For details, see Table 3.

Request Elements

This request involves no elements.

Response Syntax

1
2
HTTP/1.1 status_code
Date: date

Response Headers

The response to the request uses common headers. For details, see Table 1.

In addition to the common response headers, the following message headers may also be used. For details, see Table 2.

Table 2 Additional response header parameters

Header

Description

x-obs-delete-marker

Indicates whether an object is deleted. If the object is not marked as deleted, the response does not contain this header.

Type: boolean

Valid values: true or false

The default value is false.

x-obs-version-id

Object version ID. If the object has no version number specified, the response does not contain this header.

Valid value: character string

There is no default value.

Response Elements

This response involves no elements.

Error Responses

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

Sample Request

1
2
3
4
5
6
DELETE /object2 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.example.com
Accept: */*
Date: WED, 01 Jul 2015 04:19:21 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:MfK9JCnSFHCrJmjv7iRkRrrce2s=

Sample Response

1
2
3
4
5
HTTP/1.1 204 No Content
Server: OBS
x-obs-request-id: 8DF400000163D3F51DEA05AC9CA066F1
x-obs-id-2: 32AAAUgAIAABAAAQAAEAABAAAQAAEAABCSgkM4Dij80gAeFY8pAZIwx72QhDeBZ5
Date: WED, 01 Jul 2015 04:19:21 GMT