跳到主要内容

DeleteObject

DeleteObject用于删除某个Object。

请求语法

DELETE /objectName HTTP/1.1
Host: bucketname.cos.chinac.com
Date: GMT Date
Authorization: SignatureValue

细节分析

  1. DeleteObject要求对该Object要有写权限
  2. 如果要删除的Object不存在,COS也返回状态码404 NoSuchKey
  3. 如果Bucket不存在,返回404 Not Found

示例

请求示例

DELETE /copy_cos.jpg HTTP/1.1
Host: test-bucket.cos.chinac.com
Date: Fri, 24 Feb 2012 07:45:28 GMT
Authorization: COS qn6qrrqxo2oawuk53otfjbyc:zUglwRPGkbByZxm1+y4eyu+NIUs=

返回示例

HTTP/1.1 200
x-cos-request-id: 559CC9BDC755F95A64485981
Date: Fri, 24 Feb 2012 07:45:28 GMT
Content-Length: 0
Connection: keep-alive
Server: COS