doc-exports/docs/obs/api-swift/obs_03_0063.html
zhangyue 894279c39a Object Storage Service API Reference Swift V1
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: zhangyue <zhangyue164@huawei.com>
Co-committed-by: zhangyue <zhangyue164@huawei.com>
2023-02-02 08:50:48 +00:00

162 lines
12 KiB
HTML

<a name="obs_03_0063"></a><a name="obs_03_0063"></a>
<h1 class="topictitle1">Request</h1>
<div id="body1442649345342"><div class="section" id="obs_03_0063__section39869956112928"><h4 class="sectiontitle">Method</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0063__table36630378113016" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Method description</caption><thead align="left"><tr id="obs_03_0063__row48730343113016"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.1.2.2.4.1.1"><p id="obs_03_0063__p5336715811413">Method</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.1.2.2.4.1.2"><p id="obs_03_0063__p51296332113016"><strong id="obs_03_0063__b39273688114629">URI</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.1.2.2.4.1.3"><p id="obs_03_0063__p61362190113016">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0063__row15388804113016"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.1.2.2.4.1.1 "><p id="obs_03_0063__p38533588113016">COPY</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.1.2.2.4.1.2 "><p id="obs_03_0063__p52757727113245">/v1/{account}/{container}/{object}</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.1.2.2.4.1.3 "><p id="obs_03_0063__p19784190113016">Copies an object to another object in OBS (compatible with OpenStack Swift).</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="obs_03_0063__p7163969165558"><strong id="obs_03_0063__b13457087">{account}</strong> indicates the name of an account.</p>
<p id="obs_03_0063__p423531921048"><strong id="obs_03_0063__b16282296">{container}</strong> indicates the name of a container.</p>
<p id="obs_03_0063__p15772086165559"><strong id="obs_03_0063__b43797605">{object}</strong> indicates the name of an object.</p>
<p id="obs_03_0063__p41688322113723">This operation does not involve a request body.</p>
</div>
<div class="section" id="obs_03_0063__section16623225"><h4 class="sectiontitle">Example Request</h4><p id="obs_03_0063__p4713936114329">Copy the <strong id="obs_03_0063__b63044349">goodbye</strong> object from the <strong id="obs_03_0063__b30528233">marktwain</strong> container to the <strong id="obs_03_0063__b6318648">janeausten</strong> container:</p>
</div>
<pre class="codeblock" id="obs_03_0063__codeblock4129986016584">curl -i $publicURL/marktwain/goodbye -X COPY -H "X-Auth-Token:
$token" -H "Destination: janeausten/goodbye"</pre>
<pre class="codeblock" id="obs_03_0063__codeblock4900808216589">curl -i $publicURL/janeausten/goodbye -X PUT -H "X-Auth-Token:
$token" -H "X-Copy-From: /marktwain/goodbye" -H "Content-Length:
0"</pre>
<div class="section" id="obs_03_0063__section5103708"><h4 class="sectiontitle">Request Query Parameters</h4><p id="obs_03_0063__p57040706">This operation does not include request query parameters.</p>
</div>
<div class="section" id="obs_03_0063__section2186955"><h4 class="sectiontitle">Request Headers</h4><p id="obs_03_0063__p9908110165949">Request URI parameters</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0063__table22064127165949" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_03_0063__row51611586165949"><th align="left" class="cellrowborder" valign="top" width="20.66%" id="mcps1.3.6.3.1.4.1.1"><p id="obs_03_0063__p19788932165949">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.399999999999999%" id="mcps1.3.6.3.1.4.1.2"><p id="obs_03_0063__p64834772165949">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="64.94%" id="mcps1.3.6.3.1.4.1.3"><p id="obs_03_0063__p19908989165949">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0063__row18138392165949"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.6.3.1.4.1.1 "><p id="obs_03_0063__p59923656165949">{account}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.6.3.1.4.1.2 "><p id="obs_03_0063__p21977948165949">String</p>
<p id="obs_03_0063__p63583807165949">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.6.3.1.4.1.3 "><p id="obs_03_0063__p50014757165949">A unique account name. In the current version, it indicates a unique ID for the account.</p>
</td>
</tr>
<tr id="obs_03_0063__row47479634165949"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.6.3.1.4.1.1 "><p id="obs_03_0063__p20645123165949">{container}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.6.3.1.4.1.2 "><p id="obs_03_0063__p61642298165949">String</p>
<p id="obs_03_0063__p17909770165949">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.6.3.1.4.1.3 "><p id="obs_03_0063__p41405250165949">A unique container name.</p>
<p id="obs_03_0063__p37102931165949">For details about container naming rules, see <a href="obs_03_0009.html">Naming Rules</a>.</p>
</td>
</tr>
<tr id="obs_03_0063__row52547463165949"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.6.3.1.4.1.1 "><p id="obs_03_0063__p28486111165949">{object}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.6.3.1.4.1.2 "><p id="obs_03_0063__p25673668165949">String</p>
<p id="obs_03_0063__p29736422165949">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.6.3.1.4.1.3 "><p id="obs_03_0063__p59840009165949">An object name.</p>
<p id="obs_03_0063__p1689171165949">For details about object naming rules, see <a href="obs_03_0009.html#obs_03_0009__section23579102">Object Naming Rules</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0063__table2605133165949" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request header parameters</caption><thead align="left"><tr id="obs_03_0063__row34737820165949"><th align="left" class="cellrowborder" valign="top" width="36.54%" id="mcps1.3.6.4.2.4.1.1"><p id="obs_03_0063__p62300058165949">Header</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.939999999999998%" id="mcps1.3.6.4.2.4.1.2"><p id="obs_03_0063__p51150344165949">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.52%" id="mcps1.3.6.4.2.4.1.3"><p id="obs_03_0063__p43181781165949">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0063__row5461419165949"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.6.4.2.4.1.1 "><p id="obs_03_0063__p39721770165949">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.6.4.2.4.1.2 "><p id="obs_03_0063__p63346790165949">String</p>
<p id="obs_03_0063__p33250198165949">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.6.4.2.4.1.3 "><p id="obs_03_0063__p8911479165949">Authentication token. If you omit this header, your request fails unless the account owner has granted you access through an ACL.</p>
</td>
</tr>
<tr id="obs_03_0063__row6199553317024"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.6.4.2.4.1.1 "><p id="obs_03_0063__p2108888817024">Destination</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.6.4.2.4.1.2 "><p id="obs_03_0063__p4885976117040">String</p>
<p id="obs_03_0063__p3708466617040">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.6.4.2.4.1.3 "><p id="obs_03_0063__p5282619417024">The container and object name of the destination object in the <strong id="obs_03_0063__b54702703">/container/object</strong> format.</p>
</td>
</tr>
<tr id="obs_03_0063__row13094450165949"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.6.4.2.4.1.1 "><p id="obs_03_0063__p54017555165949">X-Object-Meta-name</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.6.4.2.4.1.2 "><p id="obs_03_0063__p13345873165949">String</p>
<p id="obs_03_0063__p53003998165949">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.6.4.2.4.1.3 "><p id="obs_03_0063__p65465458165949">Object metadata, where <strong id="obs_03_0063__b2150722715140">{name}</strong> is the name of the metadata item. You must specify an <strong id="obs_03_0063__b1327692239145812">X-Object-Meta-{name}</strong> header for each metadata item (for each <strong id="obs_03_0063__b1639042642145812">{name}</strong>) that you want to add or update.</p>
</td>
</tr>
<tr id="obs_03_0063__row52318210165949"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.6.4.2.4.1.1 "><p id="obs_03_0063__p9916613165949">Content-Type</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.6.4.2.4.1.2 "><p id="obs_03_0063__p65048197165949">String</p>
<p id="obs_03_0063__p48562863165949">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.6.4.2.4.1.3 "><p id="obs_03_0063__p41277812165949">Sets the MIME type of the object.</p>
</td>
</tr>
<tr id="obs_03_0063__row42990608165949"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.6.4.2.4.1.1 "><p id="obs_03_0063__p59687260165949">Content-Length</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.6.4.2.4.1.2 "><p id="obs_03_0063__p2829859165949">String</p>
<p id="obs_03_0063__p25468737165949">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.6.4.2.4.1.3 "><p id="obs_03_0063__p49701839165949">Object length.</p>
</td>
</tr>
<tr id="obs_03_0063__row49988103165949"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.6.4.2.4.1.1 "><p id="obs_03_0063__p22504532165949">Content-Disposition</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.6.4.2.4.1.2 "><p id="obs_03_0063__p10927785165949">String</p>
<p id="obs_03_0063__p31241207165949">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.6.4.2.4.1.3 "><p id="obs_03_0063__p47509804165949">When the header is set to <strong id="obs_03_0063__b6222962">{newname}</strong> and an object is downloaded through a browser, the default object name <strong id="obs_03_0063__b56006663">{newname}</strong> is returned.</p>
</td>
</tr>
<tr id="obs_03_0063__row24935053165949"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.6.4.2.4.1.1 "><p id="obs_03_0063__p6473452165949">Content-Encoding</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.6.4.2.4.1.2 "><p id="obs_03_0063__p54587636165949">String</p>
<p id="obs_03_0063__p21526678165949">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.6.4.2.4.1.3 "><p id="obs_03_0063__p65939373165949">If this header is set, the value is the encoding format used when an object is downloaded through a browser.</p>
</td>
</tr>
<tr id="obs_03_0063__row4458523217727"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.6.4.2.4.1.1 "><p id="obs_03_0063__p5463404017727">X-Copy-From</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.6.4.2.4.1.2 "><p id="obs_03_0063__p4911470617738">String</p>
<p id="obs_03_0063__p3937917417738">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.6.4.2.4.1.3 "><p id="obs_03_0063__p2549813417727">Container and object name of the source object in the <strong id="obs_03_0063__b49251786">/container/object</strong> format.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note" id="obs_03_0063__note555261261786"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_03_0063__p299730931786">If the <strong id="obs_03_0063__b11794154">X-Copy-From</strong> or <strong id="obs_03_0063__b39038529">Destination</strong> header is used to specify the name of a source or destination object, only the <strong id="obs_03_0063__b15802441">/container/object</strong> format is supported. OpenStack Swift lets you to use a URL as the name of a source or destination object.</p>
</div></div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_03_0062.html">Copy Object</a></div>
</div>
</div>