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 delete request that does not specify a version ID cannot permanently delete the object. Instead, OBS creates a delete marker with a unique version ID. When versioning is suspended for a bucket, a delete request that does not specify a version ID deletes the object whose version ID is null and creates a delete marker with a version ID of null.
To delete an object of a specified version, the versionId parameter can be used to specify the desired version.
WORM
OBS automatically enables versioning when you enable WORM for a bucket. If you delete an object without specifying a version ID, OBS does not really delete this object thanks to versioning, but inserts a delete marker with a unique version ID, which turns into the current version. If you specify a version ID when deleting an object protected by WORM, OBS prevents you from deleting this object and returns a 403 error. Delete markers are not protected by WORM.
Request Syntax
DELETE /ObjectName HTTP/1.1Host: bucketname.obs.region.example.comDate: dateAuthorization: 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.
Parameter | Description | Mandatory |
---|---|---|
versionId | Explanation: Version ID of the object to be deleted. Type: string Restrictions: None Value range: The value must contain 32 characters. Default value: None | No |
Request Headers
This request uses common headers. For details, see Table 3.
Request Elements
This request involves no elements.
Response Syntax
HTTP/1.1 status_codeDate: date
Response Headers
The response to the request uses common headers. For details, see Table 1.
If versioning is enabled for the bucket, the headers listed in Table 2 may also be used.
Header | Description |
---|---|
x-obs-delete-marker | Explanation: Whether an object has a delete marker. If the object is not marked as deleted, the response does not contain this header. Type: boolean Restrictions: None Value range:
Default value: false |
x-obs-version-id | Explanation: Object version ID. If the object has no version number specified, the response does not contain this header. Type: string Restrictions: None Value range: The value must contain 32 characters. Default value: None |
Response Elements
This response contains no elements.
Error Responses
No special error responses are returned. For details about error responses, see Table 2.
Sample Request
DELETE /object2 HTTP/1.1User-Agent: curl/7.29.0Host: examplebucket.obs.region.example.comAccept: */*Date: WED, 01 Jul 2015 04:19:21 GMTAuthorization: OBS H4IPJX0TQTHTHEBQQCEC:MfK9JCnSFHCrJmjv7iRkRrrce2s=
Sample Response
HTTP/1.1 204 No ContentServer: OBSx-obs-request-id: 8DF400000163D3F51DEA05AC9CA066F1x-obs-id-2: 32AAAUgAIAABAAAQAAEAABAAAQAAEAABCSgkM4Dij80gAeFY8pAZIwx72QhDeBZ5Date: WED, 01 Jul 2015 04:19:21 GMT
- Functions
- Versioning
- WORM
- Request Syntax
- Request Parameters
- Request Headers
- Request Elements
- Response Syntax
- Response Headers
- Response Elements
- Error Responses
- Sample Request
- Sample Response