doc-exports/docs/obs/api-swift/obs_03_0075.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

152 lines
12 KiB
HTML

<a name="obs_03_0075"></a><a name="obs_03_0075"></a>
<h1 class="topictitle1">Request</h1>
<div id="body1442649345353"><div class="section" id="obs_03_0075__section2546628103434"><h4 class="sectiontitle">Method</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0075__table4950298103434" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Method description</caption><thead align="left"><tr id="obs_03_0075__row45407113103434"><th align="left" class="cellrowborder" valign="top" width="12.280000000000001%" id="mcps1.3.1.2.2.4.1.1"><p id="obs_03_0075__p54097511103434">Method</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="44.42%" id="mcps1.3.1.2.2.4.1.2"><p id="obs_03_0075__p44182409103434"><strong id="obs_03_0075__b62097364103434">URI</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="43.3%" id="mcps1.3.1.2.2.4.1.3"><p id="obs_03_0075__p63830579103434">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0075__row26049921103434"><td class="cellrowborder" valign="top" width="12.280000000000001%" headers="mcps1.3.1.2.2.4.1.1 "><p id="obs_03_0075__p29668845103434">POST</p>
</td>
<td class="cellrowborder" valign="top" width="44.42%" headers="mcps1.3.1.2.2.4.1.2 "><p id="obs_03_0075__p54366205103434">/v1/{account}/{container}/{object}</p>
</td>
<td class="cellrowborder" valign="top" width="43.3%" headers="mcps1.3.1.2.2.4.1.3 "><p id="obs_03_0075__p41586457103434">Creates, updates, or deletes object metadata.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="obs_03_0075__p34150349174759"><strong id="obs_03_0075__b45927968">{account}</strong> indicates the name of an account.</p>
<p id="obs_03_0075__p38733800103434"><strong id="obs_03_0075__b29177957">{container}</strong> indicates the name of a container.</p>
<p id="obs_03_0075__p640121417481"><strong id="obs_03_0075__b14604339">{object}</strong> indicates the name of an object.</p>
<p id="obs_03_0075__p8939144272413">A POST request deletes all existing user metadata.</p>
<p id="obs_03_0075__p22229410104836">Metadata creation or update depends on whether the specified metadata already exists. Existing metadata is updated, and missing metadata is created.</p>
<p id="obs_03_0075__p13059882103434">This operation does not involve a request body.</p>
</div>
<div class="section" id="obs_03_0075__section5807786810479"><h4 class="sectiontitle">Example Request</h4><p id="obs_03_0075__p668688710479">Create or update metadata:</p>
</div>
<pre class="codeblock" id="obs_03_0075__codeblock27024411174933">curl -i $publicURL/marktwain/goodbye -X POST -H "X-Auth-Token:$token" -H "X-Object-Meta-name:value"</pre>
<p id="obs_03_0075__p476698710479">Delete metadata:</p>
<pre class="codeblock" id="obs_03_0075__codeblock5254378174937">curl -i $publicURL/marktwain/goodbye -X POST -H "X-Auth-Token:$token" -H "X-Object-Meta-name:"</pre>
<div class="section" id="obs_03_0075__section5058163010479"><h4 class="sectiontitle">Request Query Parameters</h4><p id="obs_03_0075__p347140310479">This request does not include query parameters.</p>
</div>
<div class="section" id="obs_03_0075__section3124263010479"><h4 class="sectiontitle">Request Headers</h4><p id="obs_03_0075__p5751973175113">Request URI parameters</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0075__table51767760175113" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_03_0075__row30376867175113"><th align="left" class="cellrowborder" valign="top" width="20.66%" id="mcps1.3.7.3.1.4.1.1"><p id="obs_03_0075__p44607195175113">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.399999999999999%" id="mcps1.3.7.3.1.4.1.2"><p id="obs_03_0075__p37955196175113">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="64.94%" id="mcps1.3.7.3.1.4.1.3"><p id="obs_03_0075__p20486532175113">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0075__row36514397175113"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.7.3.1.4.1.1 "><p id="obs_03_0075__p4876166175113">{account}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.7.3.1.4.1.2 "><p id="obs_03_0075__p59425164175113">String</p>
<p id="obs_03_0075__p65064429175113">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.7.3.1.4.1.3 "><p id="obs_03_0075__p35727368175113">A unique account name. In the current version, it indicates a unique ID for the account.</p>
</td>
</tr>
<tr id="obs_03_0075__row53110860175113"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.7.3.1.4.1.1 "><p id="obs_03_0075__p7012440175113">{container}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.7.3.1.4.1.2 "><p id="obs_03_0075__p31136735175113">String</p>
<p id="obs_03_0075__p11795165175113">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.7.3.1.4.1.3 "><p id="obs_03_0075__p15884331175113">A unique container name.</p>
<p id="obs_03_0075__p8741252175113">For details about container naming rules, see <a href="obs_03_0009.html">Naming Rules</a>.</p>
</td>
</tr>
<tr id="obs_03_0075__row36952817175113"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.7.3.1.4.1.1 "><p id="obs_03_0075__p40388219175113">{object}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.7.3.1.4.1.2 "><p id="obs_03_0075__p50220297175113">String</p>
<p id="obs_03_0075__p49329493175113">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.7.3.1.4.1.3 "><p id="obs_03_0075__p36266021175113">An object name.</p>
<p id="obs_03_0075__p57958739175113">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_0075__table64146271175113" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request header parameters</caption><thead align="left"><tr id="obs_03_0075__row46164324175113"><th align="left" class="cellrowborder" valign="top" width="36.54%" id="mcps1.3.7.4.2.4.1.1"><p id="obs_03_0075__p48322783175113">Header</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.939999999999998%" id="mcps1.3.7.4.2.4.1.2"><p id="obs_03_0075__p62264539175113">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.52%" id="mcps1.3.7.4.2.4.1.3"><p id="obs_03_0075__p25257187175113">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0075__row24660850175113"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.7.4.2.4.1.1 "><p id="obs_03_0075__p51371827175113">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.7.4.2.4.1.2 "><p id="obs_03_0075__p368424175113">String</p>
<p id="obs_03_0075__p3315817175113">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.7.4.2.4.1.3 "><p id="obs_03_0075__p145800175113">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_0075__row1312208175113"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.7.4.2.4.1.1 "><p id="obs_03_0075__p39179986175113">X-Object-Meta-name</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.7.4.2.4.1.2 "><p id="obs_03_0075__p19462313175113">String</p>
<p id="obs_03_0075__p40943096175113">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.7.4.2.4.1.3 "><p id="obs_03_0075__p28056489175113">Object metadata, where <strong id="obs_03_0075__b1515757184811">{name}</strong> is the name of the metadata item. To delete this item, leave <strong id="obs_03_0075__b15161057194815">{name}</strong> empty in this header. You must specify an <strong id="obs_03_0075__b44007985">X-Object-Meta-{name}</strong> header for each metadata item (for each <strong id="obs_03_0075__b60527552">{name}</strong>) that you want to add or update.</p>
</td>
</tr>
<tr id="obs_03_0075__row51181813175113"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.7.4.2.4.1.1 "><p id="obs_03_0075__p52086202175113">Content-Type</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.7.4.2.4.1.2 "><p id="obs_03_0075__p58232819175113">String</p>
<p id="obs_03_0075__p54333327175113">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.7.4.2.4.1.3 "><p id="obs_03_0075__p38923346175113">Sets the MIME type of the object.</p>
</td>
</tr>
<tr id="obs_03_0075__row14765795175113"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.7.4.2.4.1.1 "><p id="obs_03_0075__p55178729175113">X-Detect-Content-Type</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.7.4.2.4.1.2 "><p id="obs_03_0075__p40292101175113">Boolean</p>
<p id="obs_03_0075__p27084589175113">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.7.4.2.4.1.3 "><p id="obs_03_0075__p46368130175113">If it is set to <strong id="obs_03_0075__b66837559">true</strong>, OBS guesses the content type based on the file name extension and ignores the value sent in the <strong id="obs_03_0075__b64667125">Content-Type</strong> header, if present.</p>
</td>
</tr>
<tr id="obs_03_0075__row40355164175113"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.7.4.2.4.1.1 "><p id="obs_03_0075__p47542824175113">Content-Length</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.7.4.2.4.1.2 "><p id="obs_03_0075__p25763561175113">String</p>
<p id="obs_03_0075__p30545465175113">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.7.4.2.4.1.3 "><p id="obs_03_0075__p58263620175113">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_0075__row46549969175113"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.7.4.2.4.1.1 "><p id="obs_03_0075__p12451172175113">Content-Disposition</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.7.4.2.4.1.2 "><p id="obs_03_0075__p1911991175113">String</p>
<p id="obs_03_0075__p17207920175113">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.7.4.2.4.1.3 "><p id="obs_03_0075__p51664262175113">When the header is set to <strong id="obs_03_0075__b5395578">{newname}</strong> and an object is downloaded through a browser, the default object name <strong id="obs_03_0075__b48560202">{newname}</strong> is returned.</p>
</td>
</tr>
<tr id="obs_03_0075__row62325182175113"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.7.4.2.4.1.1 "><p id="obs_03_0075__p15174978175113">Content-Encoding</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.7.4.2.4.1.2 "><p id="obs_03_0075__p21213735175113">String</p>
<p id="obs_03_0075__p56705893175113">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.7.4.2.4.1.3 "><p id="obs_03_0075__p29774654175113">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>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_03_0074.html">Create/Update/Delete Object Metadata</a></div>
</div>
</div>