forked from docs/doc-exports
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
151 lines
13 KiB
HTML
151 lines
13 KiB
HTML
<a name="obs_04_0085"></a><a name="obs_04_0085"></a>
|
|
|
|
<h1 class="topictitle1">Deleting an Object</h1>
|
|
<div id="body54050549"><div class="section" id="obs_04_0085__section5584184924715"><h4 class="sectiontitle">Functions</h4><p class="msonormal" id="obs_04_0085__p32607795">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.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section25034704"><h4 class="sectiontitle">Versioning</h4><p class="msonormal" id="obs_04_0085__p16018311">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 <strong id="obs_04_0085__b789805613311">null</strong> and creates a delete marker with a version ID of <strong id="obs_04_0085__b10366999342">null</strong>.</p>
|
|
<p class="msonormal" id="obs_04_0085__p9947077">To delete an object of a specified version, the <strong id="obs_04_0085__b1866401892947">versionId</strong> parameter can be used to specify the desired version.</p>
|
|
<p id="obs_04_0085__p16753145114810">To restore a deleted object, you need to specify the delete marker version in the <strong id="obs_04_0085__b1310275220388">versionId</strong> parameter when deleting it.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section10345237111916"><h4 class="sectiontitle">WORM</h4><p id="obs_04_0085__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="obs_04_0085__section23985747"><h4 class="sectiontitle">Request Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0085__screen1215151"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span>
|
|
<span class="normal">3</span>
|
|
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span>DELETE<span class="w"> </span>/ObjectName<span class="w"> </span>HTTP/1.1<span class="w"> </span>
|
|
Host:<span class="w"> </span>bucketname.obs.region.example.com
|
|
Date:<span class="w"> </span>date
|
|
Authorization:<span class="w"> </span>authorization
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section14545133"><h4 class="sectiontitle">Request Parameters</h4><p class="msonormal" id="obs_04_0085__p13430076"><a href="#obs_04_0085__d0e15727">Table 1</a> describes the request parameters.</p>
|
|
<div class="notice" id="obs_04_0085__note156845164416"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="obs_04_0085__p73241840182110">For deleting an object, only parameters listed in <a href="#obs_04_0085__d0e15727">Table 1</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="obs_04_0085__d0e15727"></a><a name="d0e15727"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0085__d0e15727" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Request parameters</caption><thead align="left"><tr id="obs_04_0085__row44545009"><th align="left" class="cellrowborder" valign="top" width="22.220000000000002%" id="mcps1.3.5.4.2.4.1.1"><p id="obs_04_0085__p51375997">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="62.629999999999995%" id="mcps1.3.5.4.2.4.1.2"><p id="obs_04_0085__p6356363">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.15%" id="mcps1.3.5.4.2.4.1.3"><p id="obs_04_0085__p3277069">Mandatory</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0085__row40173335"><td class="cellrowborder" valign="top" width="22.220000000000002%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_04_0085__p32814727">versionId</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="62.629999999999995%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_04_0085__p40747248">Object version ID</p>
|
|
<p id="obs_04_0085__p31180913">Type: string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.15%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_04_0085__p42625985">No</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section63797335"><h4 class="sectiontitle">Request Headers</h4><p class="msonormal" id="obs_04_0085__p30152733">This request uses common headers. For details, see <a href="obs_04_0007.html#obs_04_0007__table25197309">Table 3</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section37305106"><h4 class="sectiontitle">Request Elements</h4><p class="msonormal" id="obs_04_0085__p36744422">This request involves no elements.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section201640"><h4 class="sectiontitle">Response Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0085__screen25118085"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span>HTTP/1.1<span class="w"> </span>status_code
|
|
Date:<span class="w"> </span>date
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section1814760"><h4 class="sectiontitle">Response Headers</h4><p class="msonormal" id="obs_04_0085__p1512332591013">The response to the request uses common headers. For details, see <a href="obs_04_0013.html#obs_04_0013__d0e686">Table 1</a>.</p>
|
|
<p class="msonormal" id="obs_04_0085__p24800784">If versioning is enabled for the bucket, the headers listed in <a href="#obs_04_0085__table862048515455">Table 2</a> may also be used.</p>
|
|
|
|
<div class="tablenoborder"><a name="obs_04_0085__table862048515455"></a><a name="table862048515455"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0085__table862048515455" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Additional response headers</caption><thead align="left"><tr id="obs_04_0085__row25289386"><th align="left" class="cellrowborder" valign="top" width="40.400000000000006%" id="mcps1.3.9.4.2.3.1.1"><p id="obs_04_0085__p35174418">Header</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="59.599999999999994%" id="mcps1.3.9.4.2.3.1.2"><p id="obs_04_0085__p30555594">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0085__row59084026"><td class="cellrowborder" valign="top" width="40.400000000000006%" headers="mcps1.3.9.4.2.3.1.1 "><p id="obs_04_0085__p21076811">x-obs-delete-marker</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.599999999999994%" headers="mcps1.3.9.4.2.3.1.2 "><p id="obs_04_0085__p29500132">Indicates whether an object is deleted. If the object is not marked as deleted, the response does not contain this header.</p>
|
|
<p id="obs_04_0085__p64174604">Type: boolean</p>
|
|
<p id="obs_04_0085__p40700526">Value options: <strong id="obs_04_0085__b5972123874714">true</strong>, <strong id="obs_04_0085__b5972163815473">false</strong></p>
|
|
<p id="obs_04_0085__p30760421">The default value is <strong id="obs_04_0085__b84235270618335">false</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0085__row8408337"><td class="cellrowborder" valign="top" width="40.400000000000006%" headers="mcps1.3.9.4.2.3.1.1 "><p id="obs_04_0085__p9986676">x-obs-version-id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.599999999999994%" headers="mcps1.3.9.4.2.3.1.2 "><p id="obs_04_0085__p3614399">Object version ID. If the object has no version number specified, the response does not contain this header.</p>
|
|
<p id="obs_04_0085__p32529595">Valid value: string</p>
|
|
<p id="obs_04_0085__p24330907">Default value: none</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section16332845"><h4 class="sectiontitle">Response Elements</h4><p class="msonormal" id="obs_04_0085__p24646447">This response contains no elements.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section12777878"><h4 class="sectiontitle">Error Responses</h4><p class="msonormal" id="obs_04_0085__p50205220">No special error responses are returned. For details about error responses, see <a href="obs_04_0115.html#obs_04_0115__d0e843">Table 2</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section11686111817239"><h4 class="sectiontitle">Sample Request</h4><div class="codecoloring" codetype="Xml" id="obs_04_0085__screen1832282111239"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span>
|
|
<span class="normal">3</span>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span>
|
|
<span class="normal">6</span></pre></div></td><td class="code"><div><pre><span></span>DELETE<span class="w"> </span>/object2<span class="w"> </span>HTTP/1.1
|
|
User-Agent:<span class="w"> </span>curl/7.29.0
|
|
Host:<span class="w"> </span>examplebucket.obs.region.example.com
|
|
Accept:<span class="w"> </span>*/*
|
|
Date:<span class="w"> </span>WED,<span class="w"> </span>01<span class="w"> </span>Jul<span class="w"> </span>2015<span class="w"> </span>04:19:21<span class="w"> </span>GMT
|
|
Authorization:<span class="w"> </span>OBS<span class="w"> </span>H4IPJX0TQTHTHEBQQCEC:MfK9JCnSFHCrJmjv7iRkRrrce2s=
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section6687115054912"><h4 class="sectiontitle">Sample Response</h4><div class="codecoloring" codetype="Xml" id="obs_04_0085__screen314017410502"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span>
|
|
<span class="normal">3</span>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span>HTTP/1.1<span class="w"> </span>204<span class="w"> </span>No<span class="w"> </span>Content
|
|
Server:<span class="w"> </span>OBS
|
|
x-obs-request-id:<span class="w"> </span>8DF400000163D3F51DEA05AC9CA066F1
|
|
x-obs-id-2:<span class="w"> </span>32AAAUgAIAABAAAQAAEAABAAAQAAEAABCSgkM4Dij80gAeFY8pAZIwx72QhDeBZ5
|
|
Date:<span class="w"> </span>WED,<span class="w"> </span>01<span class="w"> </span>Jul<span class="w"> </span>2015<span class="w"> </span>04:19:21<span class="w"> </span>GMT
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section143102517493"><h4 class="sectiontitle">Sample Request: Specifying <strong id="obs_04_0085__b2376631182913">versionId</strong> to Delete a Specific Object Version</h4><pre class="screen" id="obs_04_0085__screen1613013615505">DELETE /object2?versionId=G001118A49821905FFFFD28739D419DA HTTP/1.1
|
|
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:iqSPeUBl66PwXDApxjRKk6hlcN4=
|
|
User-Agent: curl/7.29.0
|
|
Host: examplebucket.obs.<em id="obs_04_0085__i6119145455715">region</em>.example.com
|
|
Date: WED, 01 Jul 2015 02:37:22 GMT
|
|
Content-Type: application/xml</pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section1989514810501"><h4 class="sectiontitle">Sample Response: Specifying <strong id="obs_04_0085__b761115118297">versionId</strong> to Delete a Specific Object Version</h4><pre class="screen" id="obs_04_0085__screen935555815017">x-obs-id-2: 32AAAUgAIAABAAAQAAEAABAAAQAAEAABCS3WJqDiMsxgGHKQrlqST9veFKpDgE50
|
|
x-obs-request-id: 0000018A4997390DD306CCDA0DEC814F
|
|
Server: OBS
|
|
Date: WED, 01 Jul 2015 02:37:22 GMT
|
|
x-obs-version-id: G001118A49821905FFFFD28739D419DA</pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section527043710512"><h4 class="sectiontitle">Sample Request: Specifying <strong id="obs_04_0085__b44641416113018">versionId</strong> to Delete a Delete Marker</h4><pre class="screen" id="obs_04_0085__screen11249164819517">DELETE /object2?versionId=G001118A6456208AFFFFD24829FCF614
|
|
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:iqSPeUBl66PwXDApxjRKk6hlcN4=
|
|
User-Agent: curl/7.29.0
|
|
Host: examplebucket.obs.<em id="obs_04_0085__i132850401903">region</em>.example.com
|
|
Date: WED, 01 Jul 2015 02:37:22 GMT
|
|
Content-Type: application/xml</pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0085__section12555180115210"><h4 class="sectiontitle">Sample Response: Specifying <strong id="obs_04_0085__b6790182643012">versionId</strong> to Delete a Delete Marker</h4><pre class="screen" id="obs_04_0085__screen697512855312">x-obs-id-2: 32AAAUgAIAABAAAQAAEAABAAAQAAEAABCS3WJqDiMsxgGHKQrlqST9veFKpDgE50
|
|
x-obs-request-id: 0000018A4997390DD306CCDA0DEC814F
|
|
Server: OBS
|
|
Date: WED, 01 Jul 2015 02:37:22 GMT
|
|
x-obs-version-id: G001118A6456208AFFFFD24829FCF614</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_04_0079.html">Operations on Objects</a></div>
|
|
</div>
|
|
</div>
|
|
|