Deletes an object. To perform the DeleteObject operation on an object, you must have the write permission on the object.

Note If the type of the requested object is symbol link, the DeleteObject operation only deletes the symbol link but not the content that the link directs to.

Request syntax

DELETE /ObjectName HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Examples

Request example:

DELETE /AK.txt HTTP/1.1
Host: test.oss-cn-zhangjiakou.aliyuncs.com
Accept-Encoding: identity
User-Agent: aliyun-sdk-python/2.6.0(Windows/7/AMD64;3.7.0)
Accept: */*
Connection: keep-alive
date: Wed, 02 Jan 2019 13:28:38 GMT
authorization: OSS qn6qrrqxo2oawuk53otfjbyc:zUglwRPGkbByZxm1+y4eyu+NIUs=zV0vhg=
Content-Length: 0

Response example:

HTTP/1.1 204 No Content
Server: AliyunOSS
Date: Wed, 02 Jan 2019 13:28:38 GMT
Content-Length: 0
Connection: keep-alive
x-oss-request-id: 5C2CBC8653718B5511EF4535
x-oss-server-time: 134

SDK

The SDKs of this API are as follows:

Error codes

Error code HTTP status code Description
Not Found 404 The bucket in which the requested object is stored does not exist.
No Content 204 The requested object does not exist.