Files
doc-exports/docs/kms/api-ref/kms_02_0044.html
qiaoli 18397ded73 kms_api_2025042703
Reviewed-by: Belejkanic, Lukas <lukas.belejkanic@t-systems.com>
Co-authored-by: qiaoli <qiaoli@huawei.com>
Co-committed-by: qiaoli <qiaoli@huawei.com>
2025-12-09 09:29:44 +00:00

138 lines
12 KiB
HTML

<a name="kms_02_0044"></a><a name="kms_02_0044"></a>
<h1 class="topictitle1">Querying Project Tags</h1>
<div id="body1521020894928"><div class="section" id="kms_02_0044__en-us_topic_0112992316_section396540155814"><h4 class="sectiontitle">Function</h4><p id="kms_02_0044__en-us_topic_0112992316_p5444189175812">This API enables you to query all tag sets of a specified project.</p>
</div>
<div class="section" id="kms_02_0044__en-us_topic_0112992316_section45111117115918"><h4 class="sectiontitle">URI</h4><ul id="kms_02_0044__en-us_topic_0112992316_ul132411362019"><li id="kms_02_0044__en-us_topic_0112992316_li19240261307">URI format<p id="kms_02_0044__en-us_topic_0112992316_p1985147903"><a name="kms_02_0044__en-us_topic_0112992316_li19240261307"></a><a name="en-us_topic_0112992316_li19240261307"></a>GET /v1.0/{project_id}/kms/tags</p>
</li><li id="kms_02_0044__en-us_topic_0112992316_li122401062013">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="kms_02_0044__en-us_topic_0112992316_table5241461905" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameter</caption><thead align="left"><tr id="kms_02_0044__en-us_topic_0112992316_row42402064012"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.2.2.2.1.2.5.1.1"><p id="kms_02_0044__en-us_topic_0112992316_p202401061602">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.02%" id="mcps1.3.2.2.2.1.2.5.1.2"><p id="kms_02_0044__en-us_topic_0112992316_p0240763013">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.98%" id="mcps1.3.2.2.2.1.2.5.1.3"><p id="kms_02_0044__en-us_topic_0112992316_p32401367016">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.2.2.1.2.5.1.4"><p id="kms_02_0044__en-us_topic_0112992316_p172401161700">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kms_02_0044__en-us_topic_0112992316_row7241766019"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="kms_02_0044__en-us_topic_0112992316_p1424046504">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="16.02%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="kms_02_0044__en-us_topic_0112992316_p4241176705">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.98%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="kms_02_0044__en-us_topic_0112992316_p4386100291125">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="kms_02_0044__en-us_topic_0112992316_p142411260018">Project ID</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="kms_02_0044__en-us_topic_0112992316_section2099414217011"><h4 class="sectiontitle">Requests</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_HeaderParameter" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request header parameters</caption><thead align="left"><tr id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_row209291944115219"><th align="left" class="cellrowborder" valign="top" width="20.080000000000002%" id="mcps1.3.3.2.2.5.1.1"><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_p17930194414521">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.919999999999998%" id="mcps1.3.3.2.2.5.1.2"><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_p15930244195213">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.2.5.1.3"><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_p39301444155210">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.3.2.2.5.1.4"><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_p109301444105220">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_row1292934416529"><td class="cellrowborder" valign="top" width="20.080000000000002%" headers="mcps1.3.3.2.2.5.1.1 "><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_p109311444155211">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="19.919999999999998%" headers="mcps1.3.3.2.2.5.1.2 "><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_p9931104412528">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.3 "><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_p193104485212">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.2.2.5.1.4 "><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0000001176937539_p1093134420527">User token. It can be obtained by calling an IAM API. The value of <strong id="kms_02_0044__en-us_topic_0112992316_b642472313105157">X-Subject-Token</strong> in the response header is the user token.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="kms_02_0044__en-us_topic_0112992316_section8148203216011"><h4 class="sectiontitle">Responses</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="kms_02_0044__en-us_topic_0112992316_table17789425210" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Response parameters</caption><thead align="left"><tr id="kms_02_0044__en-us_topic_0112992316_row077610421225"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.4.2.2.5.1.1"><p id="kms_02_0044__en-us_topic_0112992316_p1577110425210">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16%" id="mcps1.3.4.2.2.5.1.2"><p id="kms_02_0044__en-us_topic_0112992316_p167751142326">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.4.2.2.5.1.3"><p id="kms_02_0044__en-us_topic_0112992316_p157711420214">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.2.2.5.1.4"><p id="kms_02_0044__en-us_topic_0112992316_p1877644212217">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kms_02_0044__en-us_topic_0112992316_row13778742121"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.4.2.2.5.1.1 "><p id="kms_02_0044__en-us_topic_0112992316_p377634219218">tags</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.4.2.2.5.1.2 "><p id="kms_02_0044__en-us_topic_0112992316_p11777642424">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.4.2.2.5.1.3 "><p id="kms_02_0044__en-us_topic_0112992316_p776212466137">Array of objects</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.5.1.4 "><div class="p" id="kms_02_0044__en-us_topic_0112992316_p2811222164320">list of tags, including tag keys and tag values.<ul id="kms_02_0044__en-us_topic_0112992316_ul17835144253711"><li id="kms_02_0044__en-us_topic_0112992316_li883514219377"><strong id="kms_02_0044__en-us_topic_0112992316_b842352706165737">key</strong> indicates the tag key. A CMK can have a maximum of 10 keys, and each of them is unique and cannot be empty. A key cannot have duplicate values. The value of <strong id="kms_02_0044__en-us_topic_0112992316_b842352706165433">key</strong> contains a maximum of 36 characters.</li><li id="kms_02_0044__en-us_topic_0112992316_li6835144219377"><strong id="kms_02_0044__en-us_topic_0112992316_b842352706165447">value</strong> indicates the tag value. Each tag value can contain a maximum of 43 characters. The relationship between values is <strong id="kms_02_0044__en-us_topic_0112992316_b842352706165526">AND</strong>.</li></ul>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="kms_02_0044__en-us_topic_0112992316_section12430172338"><h4 class="sectiontitle">Examples</h4><p id="kms_02_0044__en-us_topic_0112992316_p1846911715317">The following example describes how to query project tags.</p>
<ul id="kms_02_0044__en-us_topic_0112992316_ul10784195519319"><li id="kms_02_0044__en-us_topic_0112992316_li87821355103110">Example request<p id="kms_02_0044__en-us_topic_0112992316_p1415949325"><a name="kms_02_0044__en-us_topic_0112992316_li87821355103110"></a><a name="en-us_topic_0112992316_li87821355103110"></a>None</p>
</li><li id="kms_02_0044__en-us_topic_0112992316_li127821552316">Example response<pre class="screen" id="kms_02_0044__en-us_topic_0112992316_screen478215563119">{ "tags": [
{
"key": "key1",
"values": [
"value1",
"value2"
]
},
{
"key": "key2",
"values": [
"value1",
"value2"
]
}
]
}</pre>
<div class="p" id="kms_02_0044__en-us_topic_0112992316_p106931869327">or<pre class="screen" id="kms_02_0044__en-us_topic_0112992316_screen1784255143113">{
"error": {
"error_code": "KMS.XXXX",
"error_msg": "XXX"
}
}</pre>
</div>
</li></ul>
</div>
<div class="section" id="kms_02_0044__en-us_topic_0112992316_section192111133389"><h4 class="sectiontitle">Status Codes</h4><div class="p" id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_en-us_topic_0079615001_p17772351"><a href="#kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_en-us_topic_0079615001_table20596071">Table 4</a> lists the normal status code returned by the response.
<div class="tablenoborder"><a name="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_en-us_topic_0079615001_table20596071"></a><a name="en-us_topic_0112992316_en-us_topic_0112992294_en-us_topic_0079615001_table20596071"></a><table cellpadding="4" cellspacing="0" summary="" id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_en-us_topic_0079615001_table20596071" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Status codes</caption><thead align="left"><tr id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_en-us_topic_0079615001_row9746163"><th align="left" class="cellrowborder" valign="top" width="16.16%" id="mcps1.3.6.2.2.2.4.1.1"><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_p57545694203043">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="28.28%" id="mcps1.3.6.2.2.2.4.1.2"><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_p4531342288">Status</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="55.559999999999995%" id="mcps1.3.6.2.2.2.4.1.3"><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_p30689603203043">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_en-us_topic_0079615001_row48621261"><td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.6.2.2.2.4.1.1 "><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_en-us_topic_0079615001_p46008046">200</p>
</td>
<td class="cellrowborder" valign="top" width="28.28%" headers="mcps1.3.6.2.2.2.4.1.2 "><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_p7538425819">OK</p>
</td>
<td class="cellrowborder" valign="top" width="55.559999999999995%" headers="mcps1.3.6.2.2.2.4.1.3 "><p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_p1885682315512">Request processed successfully.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p id="kms_02_0044__en-us_topic_0112992316_en-us_topic_0112992294_p5626181018551">Exception status code. For details, see <a href="kms_02_0301.html#kms_02_0301">Status Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="kms_02_0011.html">CMK Management</a></div>
</div>
</div>