doc-exports/docs/smn/api-ref/smn_api_56005.html
guoyanyan feae604f17 SMN API 20220929 v1
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: guoyanyan <guoyanyan3@huawei.com>
Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
2022-11-10 09:15:21 +00:00

148 lines
12 KiB
HTML

<a name="smn_api_56005"></a><a name="smn_api_56005"></a>
<h1 class="topictitle1">Querying Resource Tags</h1>
<div id="body1523350913840"><div class="section" id="smn_api_56005__section199791258152011"><h4 class="sectiontitle">Description</h4><ul id="smn_api_56005__ul33304380203733"><li id="smn_api_56005__li51147505203733">API name<p id="smn_api_56005__p38624841203741">ListResourceTags</p>
</li></ul>
<ul id="smn_api_56005__ul20998054203745"><li id="smn_api_56005__li46884910203750">Function<p id="smn_api_56005__p11151185911205">Query tags of a specified resource.</p>
</li></ul>
</div>
<div class="section" id="smn_api_56005__section49791258162015"><h4 class="sectiontitle">URI</h4><ul id="smn_api_56005__ul2151185952010"><li id="smn_api_56005__li111511759172012">URI format<p id="smn_api_56005__p16151259192015">GET /v2/{project_id}/{resource_type}/{resource_id}/tags</p>
</li><li id="smn_api_56005__li61517598208">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_56005__table29791058162012" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_56005__row17151155952013"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.2.2.1.1.5.1.1"><p id="smn_api_56005__p1915195972018"><strong id="smn_api_56005__b112541522174019">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.2.2.1.1.5.1.2"><p id="smn_api_56005__p3151105916206"><strong id="smn_api_56005__b6302182419405">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="23.61%" id="mcps1.3.2.2.2.1.1.5.1.3"><p id="smn_api_56005__p191517591201"><strong id="smn_api_56005__b030115252401">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="26.39%" id="mcps1.3.2.2.2.1.1.5.1.4"><p id="smn_api_56005__p1715185918204"><strong id="smn_api_56005__b16220192634014">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_56005__row51511159172015"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_56005__p201511599202">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_56005__p21513598202">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="23.61%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_56005__p215118592200">String</p>
</td>
<td class="cellrowborder" valign="top" width="26.39%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_56005__p5151115912205">Project ID</p>
<p id="smn_api_56005__p118812918506">See <a href="smn_api_66000.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
<tr id="smn_api_56005__row151511559172017"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_56005__p99531421797">resource_type</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_56005__p1495310421799">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="23.61%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_56005__p149531342296">String</p>
</td>
<td class="cellrowborder" valign="top" width="26.39%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_56005__p52661238184213">Resource type</p>
<p id="smn_api_56005__p1533013513535">The value can be the following:</p>
<p id="smn_api_56005__p14550953686"><strong id="smn_api_56005__b76637571712">smn_topic</strong>: topic</p>
<p id="smn_api_56005__p8682201993"></p>
<p id="smn_api_56005__p278251314214"></p>
</td>
</tr>
<tr id="smn_api_56005__row20151259132010"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_56005__p1363485413187">resource_id</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_56005__p463417547182">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="23.61%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_56005__p7634195417180">String</p>
</td>
<td class="cellrowborder" valign="top" width="26.39%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_56005__p176341254201810">Resource ID</p>
<p id="smn_api_56005__p57491711103514">Obtain a resource ID:</p>
<ul id="smn_api_56005__ul111761720155610"><li id="smn_api_56005__smn_api_56002_li969342316131">Add <strong id="smn_api_56005__smn_api_56002_b1046628401">X-SMN-RESOURCEID-TYPE=name</strong> in the request header and set the resource ID to the topic name.</li><li id="smn_api_56005__smn_api_56002_li1669312233134">Call the <strong id="smn_api_56005__smn_api_56002_b84235270694340">GetResourceInstances</strong> API to obtain the resource ID.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="smn_api_56005__section1799514588205"><h4 class="sectiontitle">Request</h4><ul id="smn_api_56005__ul151511859192015"><li id="smn_api_56005__li171518599206">Parameter description<p id="smn_api_56005__p61516597202">None</p>
</li></ul>
<ul id="smn_api_56005__ul2151859162018"><li id="smn_api_56005__li1215105942017">Request example<pre class="screen" id="smn_api_56005__screen1415165916208">GET https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/{resource_id}/tags</pre>
</li></ul>
</div>
<div class="section" id="smn_api_56005__section799516585208"><h4 class="sectiontitle">Response</h4><ul id="smn_api_56005__ul6151145902018"><li id="smn_api_56005__li915117593203">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_56005__table2010959142017" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_56005__row141511359192017"><th align="left" class="cellrowborder" valign="top" width="20.51%" id="mcps1.3.4.2.1.1.1.4.1.1"><p id="smn_api_56005__p10151105918204"><strong id="smn_api_56005__b442811136417">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33%" id="mcps1.3.4.2.1.1.1.4.1.2"><p id="smn_api_56005__p515195922016"><strong id="smn_api_56005__b1161316157419">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.160000000000004%" id="mcps1.3.4.2.1.1.1.4.1.3"><p id="smn_api_56005__p201517594209"><strong id="smn_api_56005__b1899111674120">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_56005__row17151559122015"><td class="cellrowborder" valign="top" width="20.51%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="smn_api_56005__p715119594207">tags</p>
</td>
<td class="cellrowborder" valign="top" width="33.33%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="smn_api_56005__p271610325517">Resource_tag structure array</p>
</td>
<td class="cellrowborder" valign="top" width="46.160000000000004%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="smn_api_56005__p1815155919201">Tag list. For details, see <a href="#smn_api_56005__table1127111434346">Table 1</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="smn_api_56005__table1127111434346"></a><a name="table1127111434346"></a><table cellpadding="4" cellspacing="0" summary="" id="smn_api_56005__table1127111434346" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Resource_tag structure</caption><thead align="left"><tr id="smn_api_56005__smn_api_56001_row139311651171713"><th align="left" class="cellrowborder" valign="top" width="18.81188118811881%" id="mcps1.3.4.2.1.2.2.6.1.1"><p id="smn_api_56005__smn_api_56001_p993135161718"><strong id="smn_api_56005__smn_api_56001_b6377153915111">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.841584158415841%" id="mcps1.3.4.2.1.2.2.6.1.2"><p id="smn_api_56005__smn_api_56001_p19311451131719"><strong id="smn_api_56005__smn_api_56001_b553769561">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.841584158415841%" id="mcps1.3.4.2.1.2.2.6.1.3"><p id="smn_api_56005__smn_api_56001_p13931451141710"><strong id="smn_api_56005__smn_api_56001_b1343797695">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="12.871287128712872%" id="mcps1.3.4.2.1.2.2.6.1.4"><p id="smn_api_56005__smn_api_56001_p393125141712"><strong id="smn_api_56005__smn_api_56001_b36311841175120">Description</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="36.633663366336634%" id="mcps1.3.4.2.1.2.2.6.1.5"><p id="smn_api_56005__smn_api_56001_p1715443212610"><strong id="smn_api_56005__smn_api_56001_b134437429517">Constraint</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="smn_api_56005__smn_api_56001_row3931105113173"><td class="cellrowborder" valign="top" width="18.81188118811881%" headers="mcps1.3.4.2.1.2.2.6.1.1 "><p id="smn_api_56005__smn_api_56001_p17931145131711">key</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.4.2.1.2.2.6.1.2 "><p id="smn_api_56005__smn_api_56001_p9931145120179">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.4.2.1.2.2.6.1.3 "><p id="smn_api_56005__smn_api_56001_p16931751111714">String</p>
</td>
<td class="cellrowborder" valign="top" width="12.871287128712872%" headers="mcps1.3.4.2.1.2.2.6.1.4 "><p id="smn_api_56005__smn_api_56001_p393175116171">Tag key</p>
</td>
<td class="cellrowborder" valign="top" width="36.633663366336634%" headers="mcps1.3.4.2.1.2.2.6.1.5 "><p id="smn_api_56005__smn_api_56001_p171314419267">The key contains 36 Unicode characters at most and cannot be blank or an empty string. It can contain only digits, letters, hyphens (-), and underscores (_) and must not start or end with a space.</p>
</td>
</tr>
<tr id="smn_api_56005__smn_api_56001_row39312515173"><td class="cellrowborder" valign="top" width="18.81188118811881%" headers="mcps1.3.4.2.1.2.2.6.1.1 "><p id="smn_api_56005__smn_api_56001_p09311651171711">value</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.4.2.1.2.2.6.1.2 "><p id="smn_api_56005__smn_api_56001_p1693155113179">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.4.2.1.2.2.6.1.3 "><p id="smn_api_56005__smn_api_56001_p14931751141720">String</p>
</td>
<td class="cellrowborder" valign="top" width="12.871287128712872%" headers="mcps1.3.4.2.1.2.2.6.1.4 "><p id="smn_api_56005__smn_api_56001_p159313515179">Tag value</p>
</td>
<td class="cellrowborder" valign="top" width="36.633663366336634%" headers="mcps1.3.4.2.1.2.2.6.1.5 "><p id="smn_api_56005__smn_api_56001_p344164632615">Each value contains 43 Unicode characters at most and can be an empty string. It can contain only digits, letters, hyphens (-), and underscores (_) and must not start or end with a space.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<ul id="smn_api_56005__ul10151155932018"><li id="smn_api_56005__li11151195914208">Response example<pre class="screen" id="smn_api_56005__screen215115972018">{
"tags": [
{
"key": "key1",
"value": "value1"
},
{
"key": "key2",
"value": "value3"
}
]
}</pre>
</li></ul>
</div>
<div class="section" id="smn_api_56005__section242171292113"><h4 class="sectiontitle">Returned Value</h4><p id="smn_api_56005__p13638112411919">See section <a href="smn_api_63002.html">Returned Value</a>.</p>
</div>
<div class="section" id="smn_api_56005__section73211020122511"><h4 class="sectiontitle">Error Code</h4><p id="smn_api_56005__p9759142919265">See section <a href="smn_api_64000.html">Error Code</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="smn_api_56000.html">Resource Tag Operations</a></div>
</div>
</div>