doc-exports/docs/obs/s3api/en-us_topic_0125560459.html
zhangyue 6fcdbfd13e OBS S3 API DOC
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com>
Co-authored-by: zhangyue <zhangyue164@huawei.com>
Co-committed-by: zhangyue <zhangyue164@huawei.com>
2024-02-26 11:17:13 +00:00

139 lines
12 KiB
HTML

<a name="EN-US_TOPIC_0125560459"></a><a name="EN-US_TOPIC_0125560459"></a>
<h1 class="topictitle1">DELETE Object</h1>
<div id="body22430675"><p class="msonormal" id="EN-US_TOPIC_0125560459__p44374437">You can use this operation to delete an object as long as you have <strong id="EN-US_TOPIC_0125560459__b549487">WRITE</strong> permission for the object, you can delete the object. OBS returns a success response even if the object to be deleted does not exist.</p>
<div class="section" id="EN-US_TOPIC_0125560459__section63825615"><h4 class="sectiontitle">Versioning</h4><p class="msonormal" id="EN-US_TOPIC_0125560459__p14737120947">If a bucket has versioning enabled, a deletion mark with a unique version ID is generated after an object in the bucket is deleted with no version ID specified.</p>
<p class="msonormal" id="EN-US_TOPIC_0125560459__p44508523">If a bucket has versioning suspended, a deletion mark with version ID <strong id="EN-US_TOPIC_0125560459__b65032387">null</strong> is generated after an object in the bucket is deleted with no version ID specified. The object whose version is <strong id="EN-US_TOPIC_0125560459__b48420578">null</strong> (if such an object exists) is physically deleted.</p>
<p class="msonormal" id="EN-US_TOPIC_0125560459__p33132024">You can specify <strong id="EN-US_TOPIC_0125560459__b29752766">versionId</strong> to delete an object of the specified version.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section10345237111916"><h4 class="sectiontitle">WORM</h4><p id="EN-US_TOPIC_0125560459__p217115712263">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.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section26250571"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560459__screen54270758112853">DELETE /ObjectKey HTTP/1.1
User-Agent: agent
Host: bucketname.obs.example.com
Accept: */*
Date: date
Authorization: authorization</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section34928551"><h4 class="sectiontitle">Request parameters</h4><p id="EN-US_TOPIC_0125560459__p37856118"><a href="#EN-US_TOPIC_0125560459__table57902635">Table 1</a> describes the request parameter.</p>
<div class="notice" id="EN-US_TOPIC_0125560459__note92291832638"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="EN-US_TOPIC_0125560459__p73241840182110">For deleting an object, only parameters listed in <a href="#EN-US_TOPIC_0125560459__table57902635">Table1 Request parameter</a> are supported. If the request contains parameters that cannot be identified by OBS, the server returns the 400 error code.</p>
</div></div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560459__table57902635"></a><a name="table57902635"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560459__table57902635" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Request parameter</caption><thead align="left"><tr id="EN-US_TOPIC_0125560459__row15224096"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.5.4.2.4.1.1"><p id="EN-US_TOPIC_0125560459__p25192244">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.5.4.2.4.1.2"><p id="EN-US_TOPIC_0125560459__p27305877">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.5.4.2.4.1.3"><p id="EN-US_TOPIC_0125560459__p64292394">Remarks</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0125560459__row41760635"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.4.2.4.1.1 "><p id="EN-US_TOPIC_0125560459__p27168314">versionId</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.4.2.4.1.2 "><p id="EN-US_TOPIC_0125560459__p53149858">Indicates the version ID of an object to be deleted.</p>
<p id="EN-US_TOPIC_0125560459__p8586676">Type: String</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.5.4.2.4.1.3 "><p id="EN-US_TOPIC_0125560459__p24432171">Optional</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section45921510"><h4 class="sectiontitle">Request Headers</h4><p id="EN-US_TOPIC_0125560459__p27204315">This request uses common headers. For details about common request headers, see section <a href="en-us_topic_0125560462.html">Common Request Headers</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section10640407"><h4 class="sectiontitle">Request Elements</h4><p id="EN-US_TOPIC_0125560459__p45044734">This request involves no elements.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section38530503"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560459__screen6885080112914">HTTP/1.1 status_code
Server: Server Name
x-amz-request-id: request id
x-amz-id-2: id
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
Date: date</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section11230212"><h4 class="sectiontitle">Response Headers</h4><p id="EN-US_TOPIC_0125560459__p40701910">This response uses common headers. For details about common response headers, see section <a href="en-us_topic_0125560484.html">Common Response Headers</a>. In addition, this response also uses optional headers, as described in <a href="#EN-US_TOPIC_0125560459__table2749429">Table 2</a>.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560459__table2749429"></a><a name="table2749429"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560459__table2749429" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Optional response headers</caption><thead align="left"><tr id="EN-US_TOPIC_0125560459__row18981865"><th align="left" class="cellrowborder" valign="top" width="30.97%" id="mcps1.3.9.3.2.3.1.1"><p id="EN-US_TOPIC_0125560459__p61136126">Header</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="69.03%" id="mcps1.3.9.3.2.3.1.2"><p id="EN-US_TOPIC_0125560459__p53079196">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0125560459__row4447594"><td class="cellrowborder" valign="top" width="30.97%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560459__p24710800">x-amz-delete-marker</p>
</td>
<td class="cellrowborder" valign="top" width="69.03%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560459__p55417783">Indicates whether an object is marked as deleted. If an object is not marked as deleted, the header is not returned.</p>
<p id="EN-US_TOPIC_0125560459__p28998002">Type: Boolean</p>
<p id="EN-US_TOPIC_0125560459__p59655430">Valid values: true|false</p>
<p id="EN-US_TOPIC_0125560459__p27965">Default: false</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560459__row251686"><td class="cellrowborder" valign="top" width="30.97%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560459__p20386623">x-amz-version-id</p>
</td>
<td class="cellrowborder" valign="top" width="69.03%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560459__p40703736">Indicates the version ID of an object. If an object has no version ID, this header is not returned.</p>
<p id="EN-US_TOPIC_0125560459__p30789304">Valid values: String</p>
<p id="EN-US_TOPIC_0125560459__p8668281">Default: None</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section33963045"><h4 class="sectiontitle">Response Elements</h4><p id="EN-US_TOPIC_0125560459__p10943941">This response involves no elements.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section37231957"><h4 class="sectiontitle">Error Responses</h4><p id="EN-US_TOPIC_0125560459__p14044067">No special error responses are returned. For details about error responses, see <a href="en-us_topic_0125560440.html#EN-US_TOPIC_0125560440__table30733758">Table 1</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section2524942"><h4 class="sectiontitle">Sample Request</h4><pre class="screen" id="EN-US_TOPIC_0125560459__screen187428112950">DELETE /test HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1
Host: bucketname.obs.example.com
Accept: */*
Date: Sat, 03 Dec 2011 08:38:16 +0000
Authorization: AWS BF6C09F302931425E9A7:wQ1Tp3rD7kaUCsYfPKxOIN7NoSA=</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section22724481"><h4 class="sectiontitle">Sample Response</h4><pre class="screen" id="EN-US_TOPIC_0125560459__screen1125314511300">HTTP/1.1 204 No Content
Server: OBS
x-amz-request-id: 001B21A61C6C000001340312E226528D
x-amz-id-2: MDAxQjIxQTYxQzZDMDAwMDAxMzQwMzEyRTIyNjUyOERBQUFBQUFBQWJiYmJiYmJi
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
Content-Type: text/xml
Date: Sat, 03 Dec 2011 08:38:18 GMT</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section28743664"><h4 class="sectiontitle">Sample Request (Deleting an Object with Version ID Specified)</h4><pre class="screen" id="EN-US_TOPIC_0125560459__screen5933864113013">DELETE /object?versionId=AAABQ4-YOzfc0vycq3gAAAAUVURTRkha HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1
Host: bucketname.obs.example.com
Accept: */*
Date: Tue, 14 Jan 2014 07:12:57 +0000
Authorization: AWS C9590CEB8EC051BDEC9D:DxZpQ520WCv/yMgrUjBemFORuN0=</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section57366391"><h4 class="sectiontitle">Sample Response (Deleting an Object with Version ID Specified)</h4><pre class="screen" id="EN-US_TOPIC_0125560459__screen60217405113021">HTTP/1.1 204 No Content
Server: OBS
x-amz-request-id: DCD2FC9CAB78000001438F98937AB673
x-amz-id-2: UOWLHKBXWfKaBEToXGU3Om6pl0/Bid6OmhzgdJJDxN40twtrmuCHY0rEtDdSX7zp
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
Content-Type: text/xml
x-amz-version-id: AAABQ4-YOzfc0vycq3gAAAAUVURTRkha
Date: Tue, 14 Jan 2014 07:12:57 GMT</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section16166070"><h4 class="sectiontitle">Sample Request (Deleting an Object with a Deletion Mark from a Bucket with Versioning Enabled)</h4><pre class="screen" id="EN-US_TOPIC_0125560459__screen8126883113035">DELETE /object HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1
Host: bucketname.obs.example.com
Accept: */*
Date: Tue, 14 Jan 2014 06:16:51 +0000
Authorization: AWS C9590CEB8EC051BDEC9D:VlzVUv3z3WOuSyu2l8NzVsOXY0U=</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560459__section11276905"><h4 class="sectiontitle">Sample Response (Deleting an Object with a Deletion Mark from a Bucket with Versioning Enabled)</h4><pre class="screen" id="EN-US_TOPIC_0125560459__screen37094150113050">HTTP/1.1 204 No Content
Server: OBS
x-amz-request-id: DCD2FC9CAB78000001438F65352A9AF5
x-amz-id-2: CzNX/O9/H0oZRUwAk/sWgyfVDNJMMX+v9DAzArbD40AlLtZ/TCC7H73FNIo5K81I
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
Content-Type: text/xml
x-amz-delete-marker: true
x-amz-version-id: AAABQ49lNT_c0vycq3gAAAAOVURTRkha
Date: Tue, 14 Jan 2014 06:16:51 GMT</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0125560489.html">Operations on Objects</a></div>
</div>
</div>