1
0
forked from docs/doc-exports
doc-exports/docs/obs/api-swift/obs_03_0059.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

233 lines
19 KiB
HTML

<a name="obs_03_0059"></a><a name="obs_03_0059"></a>
<h1 class="topictitle1">Request</h1>
<div id="body1442649345334"><div class="section" id="obs_03_0059__section39869956112928"><h4 class="sectiontitle">Method</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0059__table36630378113016" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Method description</caption><thead align="left"><tr id="obs_03_0059__row48730343113016"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.1.2.2.4.1.1"><p id="obs_03_0059__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_0059__p51296332113016"><strong id="obs_03_0059__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_0059__p61362190113016">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0059__row15388804113016"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.1.2.2.4.1.1 "><p id="obs_03_0059__p38533588113016">PUT</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.1.2.2.4.1.2 "><p id="obs_03_0059__p52757727113245">/v1/{account}/{container}/{object}{?temp_url_sig,temp_url_expires,multipart-manifest}</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.1.2.2.4.1.3 "><p id="obs_03_0059__p19784190113016">Creates an object in the specified container.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="obs_03_0059__p565312949827"><strong id="obs_03_0059__b62450879">{account}</strong> indicates the name of an account. <strong id="obs_03_0059__b25187000">{container}</strong> indicates the name of a container. <strong id="obs_03_0059__b25356414">{object}</strong> indicates the name of an object.</p>
<p id="obs_03_0059__p41688322113723">The request body of this operation is the object content.</p>
</div>
<div class="section" id="obs_03_0059__section16623225"><h4 class="sectiontitle">Example Request</h4><p id="obs_03_0059__p31826149155630">Create an object:</p>
</div>
<pre class="codeblock" id="obs_03_0059__codeblock1317597420517">curl -i $publicURL/marktwain/helloworld.txt -X PUT
-H "X-Auth-Token: $token"</pre>
<div class="section" id="obs_03_0059__section5103708"><h4 class="sectiontitle">Request Query Parameters</h4><p id="obs_03_0059__p51632058143412"><a href="#obs_03_0059__table21447202143412">Table 2</a> describes the query parameters for getting the object content.</p>
<div class="tablenoborder"><a name="obs_03_0059__table21447202143412"></a><a name="table21447202143412"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0059__table21447202143412" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request query parameters</caption><thead align="left"><tr id="obs_03_0059__row59154676143412"><th align="left" class="cellrowborder" valign="top" width="18.05%" id="mcps1.3.4.3.2.5.1.1"><p id="obs_03_0059__p26799486143412">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.46%" id="mcps1.3.4.3.2.5.1.2"><p id="obs_03_0059__p8146475143412">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="58.599999999999994%" id="mcps1.3.4.3.2.5.1.3"><p id="obs_03_0059__p33200335143412">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13.889999999999999%" id="mcps1.3.4.3.2.5.1.4"><p id="obs_03_0059__p43853575143412">Required or Not</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0059__row25436980143412"><td class="cellrowborder" valign="top" width="18.05%" headers="mcps1.3.4.3.2.5.1.1 "><p id="obs_03_0059__p47129522143412">temp_url_sig</p>
</td>
<td class="cellrowborder" valign="top" width="9.46%" headers="mcps1.3.4.3.2.5.1.2 "><p id="obs_03_0059__p59394912143412">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.599999999999994%" headers="mcps1.3.4.3.2.5.1.3 "><p id="obs_03_0059__p46258534143412">Used with TempURL to sign the request.</p>
</td>
<td class="cellrowborder" valign="top" width="13.889999999999999%" headers="mcps1.3.4.3.2.5.1.4 "><p id="obs_03_0059__p55953773143412">No</p>
</td>
</tr>
<tr id="obs_03_0059__row33821912143412"><td class="cellrowborder" valign="top" width="18.05%" headers="mcps1.3.4.3.2.5.1.1 "><p id="obs_03_0059__p55220355143412">temp_url_expires</p>
</td>
<td class="cellrowborder" valign="top" width="9.46%" headers="mcps1.3.4.3.2.5.1.2 "><p id="obs_03_0059__p43663746143412">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.599999999999994%" headers="mcps1.3.4.3.2.5.1.3 "><p id="obs_03_0059__p47102526143412">Used with TempURL to specify the expiry time of the signature.</p>
</td>
<td class="cellrowborder" valign="top" width="13.889999999999999%" headers="mcps1.3.4.3.2.5.1.4 "><p id="obs_03_0059__p57208222143412">No</p>
</td>
</tr>
<tr id="obs_03_0059__row45111951143412"><td class="cellrowborder" valign="top" width="18.05%" headers="mcps1.3.4.3.2.5.1.1 "><p id="obs_03_0059__p30189409143412">multipart-manifest</p>
</td>
<td class="cellrowborder" valign="top" width="9.46%" headers="mcps1.3.4.3.2.5.1.2 "><p id="obs_03_0059__p29423051143412">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.599999999999994%" headers="mcps1.3.4.3.2.5.1.3 "><p id="obs_03_0059__p34456950143412">If <strong id="obs_03_0059__b18330915">multipart-manifest=put</strong> is set, the object is a static large object manifest and the body contains the manifest.</p>
</td>
<td class="cellrowborder" valign="top" width="13.889999999999999%" headers="mcps1.3.4.3.2.5.1.4 "><p id="obs_03_0059__p39549578143412">No</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="obs_03_0059__section2186955"><h4 class="sectiontitle">Request Headers</h4><p id="obs_03_0059__p47065774155054">Request URI parameters</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0059__table20938788155054" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_03_0059__row7298938155054"><th align="left" class="cellrowborder" valign="top" width="20.66%" id="mcps1.3.5.3.1.4.1.1"><p id="obs_03_0059__p54343123155054">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.399999999999999%" id="mcps1.3.5.3.1.4.1.2"><p id="obs_03_0059__p21906988155054">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="64.94%" id="mcps1.3.5.3.1.4.1.3"><p id="obs_03_0059__p65393599155054">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0059__row24640471155054"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.5.3.1.4.1.1 "><p id="obs_03_0059__p49721145155054">{account}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.5.3.1.4.1.2 "><p id="obs_03_0059__p880968155054">String</p>
<p id="obs_03_0059__p7928715155054">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.5.3.1.4.1.3 "><p id="obs_03_0059__p38246216155054">A unique account name. In the current version, it indicates a unique ID for the account.</p>
</td>
</tr>
<tr id="obs_03_0059__row8671627155054"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.5.3.1.4.1.1 "><p id="obs_03_0059__p31313167155054">{container}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.5.3.1.4.1.2 "><p id="obs_03_0059__p53338592155054">String</p>
<p id="obs_03_0059__p10285280155054">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.5.3.1.4.1.3 "><p id="obs_03_0059__p27801358155054">A unique container name.</p>
<p id="obs_03_0059__p48885638155054">For details about container naming rules, see <a href="obs_03_0009.html">Naming Rules</a>.</p>
</td>
</tr>
<tr id="obs_03_0059__row313773155054"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.5.3.1.4.1.1 "><p id="obs_03_0059__p25415615155054">{object}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.5.3.1.4.1.2 "><p id="obs_03_0059__p45398950155054">String</p>
<p id="obs_03_0059__p5937373155054">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.5.3.1.4.1.3 "><p id="obs_03_0059__p11165214155054">An object name.</p>
<p id="obs_03_0059__p33378066155054">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_0059__table2213898993436" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Request header parameters</caption><thead align="left"><tr id="obs_03_0059__row2383841493436"><th align="left" class="cellrowborder" valign="top" width="36.54%" id="mcps1.3.5.4.2.4.1.1"><p id="obs_03_0059__p5186338393436">Header</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.939999999999998%" id="mcps1.3.5.4.2.4.1.2"><p id="obs_03_0059__p2611644893436">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.52%" id="mcps1.3.5.4.2.4.1.3"><p id="obs_03_0059__p4708242393436">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0059__row3814052016141"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p5685283816144">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p4167717016144">String</p>
<p id="obs_03_0059__p3955021416144">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p4945073316144">Authentication token.</p>
</td>
</tr>
<tr id="obs_03_0059__row4968641311486"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p6517651711486">X-Object-Meta-name</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p4480653811486">String</p>
<p id="obs_03_0059__p27124764155127">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p545094711486">Object metadata, where <strong id="obs_03_0059__b1762272501142013">{name}</strong> is the name of the metadata item. To delete this item, leave <strong id="obs_03_0059__b1065102573118">{name}</strong> empty in this header. You must specify an <strong id="obs_03_0059__b48314965">X-Object-Meta-{name}</strong> header for each metadata item (for each <strong id="obs_03_0059__b32181504">{name}</strong>) that you want to add or update.</p>
</td>
</tr>
<tr id="obs_03_0059__row25807474114824"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p10030672114824">Content-Type</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p7178078114824">String</p>
<p id="obs_03_0059__p24211892155138">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p44553412114824">Sets the MIME type of the object.</p>
</td>
</tr>
<tr id="obs_03_0059__row21879157114848"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p27381313114848">X-Detect-Content-Type</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p3293914114848">Boolean</p>
<p id="obs_03_0059__p49629676155141">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p65480487114848">If it is set to <strong id="obs_03_0059__b4892200">true</strong>, OBS guesses the content type based on the file name extension and ignores the value sent in the <strong id="obs_03_0059__b44029805">Content-Type</strong> header, if present.</p>
</td>
</tr>
<tr id="obs_03_0059__row17969257114918"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p46223730114918">If-None-Match</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p53134619114918">String</p>
<p id="obs_03_0059__p50459426155146">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p11758873115557">Only an <strong id="obs_03_0059__b58515109">If-None-Match: *</strong> header can be specified. If an object already exists, the object fails to be created and a 412 status code is returned.</p>
</td>
</tr>
<tr id="obs_03_0059__row6571188214568"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p2106220114568">X-Object-Manifest</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p2831670914568">String</p>
<p id="obs_03_0059__p14630575155148">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p5280846145718">Set to specify that this is a dynamic large object manifest object. The value is the container and object name prefix of the segment objects in the <em id="obs_03_0059__i1338325061142219">container/prefix</em> format. UTF-8 encoding must be used.</p>
</td>
</tr>
<tr id="obs_03_0059__row9176580145948"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p5105498145948">Content-Length</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p10892230145948">String</p>
<p id="obs_03_0059__p24680746155150">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p9855405145948">Set to the length of the object content. Do not set if chunked transfer encoding is being used.</p>
</td>
</tr>
<tr id="obs_03_0059__row3910282215125"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p1321203615125">Transfer-Encoding</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p6354197015125">String</p>
<p id="obs_03_0059__p47544805155153">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p4662591215125">Set to <strong id="obs_03_0059__b37078712">chunked</strong> to enable chunked transfer encoding. If used, the <strong id="obs_03_0059__b2130495650142348">Content-Length</strong> header is ignored.</p>
</td>
</tr>
<tr id="obs_03_0059__row61594862151320"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p23127957151320">X-Copy-From</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p61425191151320">String</p>
<p id="obs_03_0059__p24362120155156">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p727792152047">The format is {container}/{object}. When this header is set, {container}/{object} is copied to create an object. UTF-8 encoding must be used.</p>
<p id="obs_03_0059__p46800850161740">Using <strong id="obs_03_0059__b62710946014282">PUT</strong> with <strong id="obs_03_0059__b153332216214282">X-Copy-From</strong> has the same effect as using the <strong id="obs_03_0059__b168272620814282">COPY</strong> operation to copy an object.</p>
<p id="obs_03_0059__p9384590151320">Using <strong id="obs_03_0059__b1857925880154747">PUT</strong> with <strong id="obs_03_0059__b1525796805154747">X-Copy-From</strong> has the same effect as <strong id="obs_03_0059__b84235270615486">COPY</strong> to create an object.</p>
</td>
</tr>
<tr id="obs_03_0059__row62839590152125"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p56842021152125">ETag</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p40801013152125">String</p>
<p id="obs_03_0059__p4822192155159">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p16547774152125">MD5 checksum value of the request body. If the MD5 checksum value of the request body is equal to the value of <strong id="obs_03_0059__b1468687397142847">ETag</strong>, the upload was successful. If not equal, a 422 status code is returned.</p>
<p id="obs_03_0059__p4116140416199">Checking the MD5 checksum value for an upload is recommended.</p>
</td>
</tr>
<tr id="obs_03_0059__row59308873153414"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p39289375153414">Content-Disposition</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p28322806153414">String</p>
<p id="obs_03_0059__p292305315521">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p12445941153414">When the header is set to <strong id="obs_03_0059__b4808105316586">{newname}</strong> and an object is downloaded through a browser, the default object name <strong id="obs_03_0059__b18081153175811">{newname}</strong> is returned.</p>
</td>
</tr>
<tr id="obs_03_0059__row1381650115387"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.4.2.4.1.1 "><p id="obs_03_0059__p4539478315387">Content-Encoding</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.4.2.4.1.2 "><p id="obs_03_0059__p5309882615387">String</p>
<p id="obs_03_0059__p3426566415524">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.4.2.4.1.3 "><p id="obs_03_0059__p603766215387">If this header is set, the value is the encoding format used when an object is downloaded through a browser.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note" id="obs_03_0059__note21783732165041"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_03_0059__p61835867165041">If chunked transfer encoding is used and the value of <strong id="obs_03_0059__b178395">Content-Length</strong> in a request is greater than the actual length of an object to be uploaded, OBS (compatible with OpenStack Swift) returns a 201 status code to indicate that the object was created successfully. In the same scenario, OpenStack Swift, in contrast, returns a 408 (Request Timeout) status code, even if but the object was created successfully.</p>
</div></div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_03_0058.html">Create or Replace Object</a></div>
</div>
</div>