doc-exports/docs/obs/api-ref/obs_04_0050.html
Jawei, Li f1cb839979 OBS api-ref 2.0.38.SP5
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Jawei, Li <lijiawei5@huawei.com>
Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
2022-11-03 11:54:51 +00:00

180 lines
10 KiB
HTML

<a name="obs_04_0050"></a><a name="obs_04_0050"></a>
<h1 class="topictitle1">Obtaining Bucket Tags</h1>
<div id="body1522727142744"><div class="section" id="obs_04_0050__section5584184924715"><h4 class="sectiontitle">Functions</h4><p id="obs_04_0050__p328123010563">This operation obtains information about tags of a bucket.</p>
<p id="obs_04_0050__p028114308563">To perform this operation, you must have the <strong id="obs_04_0050__b16326182918257">GetBucketTagging</strong> permission. By default, only the bucket owner can obtain the tags of a bucket. The bucket owner can allow other users to perform this operation by setting a bucket policy or granting them the permission.</p>
</div>
<div class="section" id="obs_04_0050__section760823317564"><h4 class="sectiontitle">Request Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0050__screen19232727152544"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>GET /?tagging HTTP/1.1
Host: bucketname.obs.region.example.com
Date: date
Authorization: authorization string
</pre></div>
</td></tr></table></div>
</div>
<div class="section" id="obs_04_0050__section1371325895711"><h4 class="sectiontitle">Request Parameters</h4><p id="obs_04_0050__p1815191317587">This request contains no parameter.</p>
</div>
<div class="section" id="obs_04_0050__section1082510151584"><h4 class="sectiontitle">Request Headers</h4><p id="obs_04_0050__p1231635205817">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_0050__section4216153718588"><h4 class="sectiontitle">Request Elements</h4><p id="obs_04_0050__p512465625811">This request involves no elements.</p>
</div>
<div class="section" id="obs_04_0050__section7375637599"><h4 class="sectiontitle">Response Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0050__screen1351602445911"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 status_code
x-obs-request-id: request id
x-obs-id-2: id
Content-Type: application/xml
Content-Length: length
Date: date
<span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;</span>
<span class="nt">&lt;Tagging</span> <span class="na">xmlns=</span><span class="s">&quot;http://obs.example.com/doc/2015-06-30/&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;TagSet&gt;</span>
<span class="nt">&lt;Tag&gt;</span>
<span class="nt">&lt;Key&gt;</span>key<span class="nt">&lt;/Key&gt;</span>
<span class="nt">&lt;Value&gt;</span>value<span class="nt">&lt;/Value&gt;</span>
<span class="nt">&lt;/Tag&gt;</span>
<span class="nt">&lt;/TagSet&gt;</span>
<span class="nt">&lt;/Tagging&gt;</span>
</pre></div>
</td></tr></table></div>
</div>
<div class="section" id="obs_04_0050__section4327836215"><h4 class="sectiontitle">Response Headers</h4><p class="msonormal" id="obs_04_0050__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>
</div>
<div class="section" id="obs_04_0050__section2085012491723"><h4 class="sectiontitle">Response Elements</h4><p id="obs_04_0050__p63829146313">This response contains elements to detail bucket tag configuration. <a href="#obs_04_0050__table1881863118318">Table 1</a> describes the elements.</p>
<div class="tablenoborder"><a name="obs_04_0050__table1881863118318"></a><a name="table1881863118318"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0050__table1881863118318" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Elements for configuring bucket tags</caption><thead align="left"><tr id="obs_04_0050__row510493213318"><th align="left" class="cellrowborder" valign="top" width="28.28%" id="mcps1.3.8.3.2.3.1.1"><p id="obs_04_0050__p210412321531">Element</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="71.72%" id="mcps1.3.8.3.2.3.1.2"><p id="obs_04_0050__p171041532932">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0050__row410416329318"><td class="cellrowborder" valign="top" width="28.28%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0050__p1010419321639">Tagging</p>
</td>
<td class="cellrowborder" valign="top" width="71.72%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0050__p13105932231">Element of the tag set and tag.</p>
<p id="obs_04_0050__p6105203213312">Type: element</p>
<p id="obs_04_0050__p16105732833">Ancestor: none</p>
</td>
</tr>
<tr id="obs_04_0050__row14105163211311"><td class="cellrowborder" valign="top" width="28.28%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0050__p1810514321035">TagSet</p>
</td>
<td class="cellrowborder" valign="top" width="71.72%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0050__p161051832232">Element of the tag set.</p>
<p id="obs_04_0050__p101067329315">Type: element</p>
<p id="obs_04_0050__p17106032232">Ancestor: Tagging</p>
</td>
</tr>
<tr id="obs_04_0050__row31061327320"><td class="cellrowborder" valign="top" width="28.28%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0050__p15106632132">Tag</p>
</td>
<td class="cellrowborder" valign="top" width="71.72%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0050__p121066328312">Element of the tag information.</p>
<p id="obs_04_0050__p21061232330">Type: element</p>
<p id="obs_04_0050__p18107432939">Ancestor: TagSet</p>
</td>
</tr>
<tr id="obs_04_0050__row18107832932"><td class="cellrowborder" valign="top" width="28.28%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0050__p0107232634">Key</p>
</td>
<td class="cellrowborder" valign="top" width="71.72%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0050__p9107163212319">Tag name.</p>
<p id="obs_04_0050__p141077321433">Type: string</p>
<p id="obs_04_0050__p101088323316">Ancestor: Tag</p>
</td>
</tr>
<tr id="obs_04_0050__row10108032336"><td class="cellrowborder" valign="top" width="28.28%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0050__p810823216311">Value</p>
</td>
<td class="cellrowborder" valign="top" width="71.72%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0050__p1010873217315">Tag value.</p>
<p id="obs_04_0050__p11108113215315">Type: string</p>
<p id="obs_04_0050__p310820325310">Ancestor: Tag</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="obs_04_0050__section75624441842"><h4 class="sectiontitle">Error Responses</h4><p id="obs_04_0050__p2866601656">In addition to common error codes, this API also returns other error codes. The following table lists common errors and possible causes. For details, see <a href="#obs_04_0050__table1488314173514">Table 2</a>.</p>
<div class="tablenoborder"><a name="obs_04_0050__table1488314173514"></a><a name="table1488314173514"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0050__table1488314173514" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Bucket tag configuration errors</caption><thead align="left"><tr id="obs_04_0050__row6181181352"><th align="left" class="cellrowborder" valign="top" width="33.67%" id="mcps1.3.9.3.2.4.1.1"><p id="obs_04_0050__p11810181514">Error Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="51.019999999999996%" id="mcps1.3.9.3.2.4.1.2"><p id="obs_04_0050__p618131810511">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.310000000000002%" id="mcps1.3.9.3.2.4.1.3"><p id="obs_04_0050__p18190181851">HTTP Status Code</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0050__row1719418653"><td class="cellrowborder" valign="top" width="33.67%" headers="mcps1.3.9.3.2.4.1.1 "><p id="obs_04_0050__p1019218752">NoSuchTagSet</p>
</td>
<td class="cellrowborder" valign="top" width="51.019999999999996%" headers="mcps1.3.9.3.2.4.1.2 "><p id="obs_04_0050__p14197185516">The specified bucket does not have any tags.</p>
</td>
<td class="cellrowborder" valign="top" width="15.310000000000002%" headers="mcps1.3.9.3.2.4.1.3 "><p id="obs_04_0050__p21916186514">404 Not Found</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="obs_04_0050__section51791023968"><h4 class="sectiontitle">Sample Request</h4><div class="codecoloring" codetype="Xml" id="obs_04_0050__screen5561411267"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
4
5
6</pre></div></td><td class="code"><div class="highlight"><pre><span></span>GET /?tagging HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.example.com
Accept: */*
Date: Wed, 27 Jun 2018 13:25:44 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:H1INcyc5i0XlHqYTfuzkPxLZUPM=
</pre></div>
</td></tr></table></div>
</div>
<div class="section" id="obs_04_0050__section18234571088"><h4 class="sectiontitle">Sample Response</h4><div class="codecoloring" codetype="Xml" id="obs_04_0050__screen1219123011919"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 200 OK
x-obs-request-id: 0002B7532E0000015BEB35330C5884X1
x-obs-id-2: s12w20LYNQqSb7moq4ibgJwmQRSmVQV+rFBqplOGYkXUpXeS/nOmbkyD+E35K79j
Content-Type: application/xml
Date: Wed, 27 Jun 2018 13:25:44 GMT
Content-Length: 441
<span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;</span>
<span class="nt">&lt;Tagging</span> <span class="na">xmlns=</span><span class="s">&quot;http://obs.example.com/doc/2015-06-30/&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;TagSet&gt;</span>
<span class="nt">&lt;Tag&gt;</span>
<span class="nt">&lt;Key&gt;</span>TagName1<span class="nt">&lt;/Key&gt;</span>
<span class="nt">&lt;Value&gt;</span>TageSetVaule1<span class="nt">&lt;/Value&gt;</span>
<span class="nt">&lt;/Tag&gt;</span>
<span class="nt">&lt;/TagSet&gt;</span>
<span class="nt">&lt;/Tagging&gt;</span>
</pre></div>
</td></tr></table></div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_04_0026.html">Advanced Bucket Settings</a></div>
</div>
</div>