doc-exports/docs/ecs/api-ref/en-us_topic_0167811967.html
Zaoxu, Li 4edaa4a4cc ECS API 20231016 version
Reviewed-by: Pristromskaia, Margarita <margarita.pristromskaia@t-systems.com>
Co-authored-by: Zaoxu, Li <lizaoxu@huawei.com>
Co-committed-by: Zaoxu, Li <lizaoxu@huawei.com>
2024-04-29 11:04:13 +00:00

111 lines
9.0 KiB
HTML

<a name="EN-US_TOPIC_0167811967"></a><a name="EN-US_TOPIC_0167811967"></a>
<h1 class="topictitle1">Querying Tags of an ECS</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_section192222559445"><h4 class="sectiontitle">Function</h4><ul id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_ul9401946101513"><li id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_li23991146171520">This API is used to query the tags of a specified ECS.</li><li id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_li5401124615158">The Tag Management Service (TMS) uses this API to query all tags of an ECS.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_section222245513448"><h4 class="sectiontitle">URI</h4><p id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_p536313559443">GET /v1/{project_id}/cloudservers/{server_id}/tags</p>
<div class="p" id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_p1127133275211"><a href="#EN-US_TOPIC_0167811967__table194262014152810">Table 1</a> describes the parameters in the URI.
<div class="tablenoborder"><a name="EN-US_TOPIC_0167811967__table194262014152810"></a><a name="table194262014152810"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0167811967__table194262014152810" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0167811967__row13426131472816"><th align="left" class="cellrowborder" valign="top" width="25.172517251725168%" id="mcps1.3.2.3.2.2.4.1.1"><p id="EN-US_TOPIC_0167811967__p72261121122819">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21.592159215921594%" id="mcps1.3.2.3.2.2.4.1.2"><p id="EN-US_TOPIC_0167811967__p10226142132816">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="53.23532353235323%" id="mcps1.3.2.3.2.2.4.1.3"><p id="EN-US_TOPIC_0167811967__p32261821102818">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0167811967__row742617148281"><td class="cellrowborder" valign="top" width="25.172517251725168%" headers="mcps1.3.2.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0167811967__p6226521132811">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="21.592159215921594%" headers="mcps1.3.2.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0167811967__p8226172117288">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="53.23532353235323%" headers="mcps1.3.2.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0167811967__p42261721162819">Specifies the project ID.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0167811967__row1042671422814"><td class="cellrowborder" valign="top" width="25.172517251725168%" headers="mcps1.3.2.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0167811967__p17226152112814">server_id</p>
</td>
<td class="cellrowborder" valign="top" width="21.592159215921594%" headers="mcps1.3.2.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0167811967__p12226132112818">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="53.23532353235323%" headers="mcps1.3.2.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0167811967__p9226121152813">Specifies the <span id="EN-US_TOPIC_0167811967__text95825915338">ECS</span> ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_section625475584419"><h4 class="sectiontitle">Request</h4><p id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_p8776355185220">None</p>
</div>
<div class="section" id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_section1825415515447"><h4 class="sectiontitle">Response</h4><p id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_p119672012195312"><a href="#EN-US_TOPIC_0167811967__table1972264711286">Table 2</a> describes the response parameters.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0167811967__table1972264711286"></a><a name="table1972264711286"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0167811967__table1972264711286" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Response parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0167811967__row10722447132815"><th align="left" class="cellrowborder" valign="top" width="18.971897189718973%" id="mcps1.3.4.3.2.4.1.1"><p id="EN-US_TOPIC_0167811967__p712312552284">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.25332533253326%" id="mcps1.3.4.3.2.4.1.2"><p id="EN-US_TOPIC_0167811967__p2123155517283">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="47.774777477747776%" id="mcps1.3.4.3.2.4.1.3"><p id="EN-US_TOPIC_0167811967__p91231855162815">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0167811967__row197221747162819"><td class="cellrowborder" valign="top" width="18.971897189718973%" headers="mcps1.3.4.3.2.4.1.1 "><p id="EN-US_TOPIC_0167811967__p51231055172816">tags</p>
</td>
<td class="cellrowborder" valign="top" width="33.25332533253326%" headers="mcps1.3.4.3.2.4.1.2 "><p id="EN-US_TOPIC_0167811967__p5123955162819">Array of objects</p>
</td>
<td class="cellrowborder" valign="top" width="47.774777477747776%" headers="mcps1.3.4.3.2.4.1.3 "><p id="EN-US_TOPIC_0167811967__p812335562813">Specifies tags. For details, see <a href="#EN-US_TOPIC_0167811967__table1148911211295">Table 3</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0167811967__table1148911211295"></a><a name="table1148911211295"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0167811967__table1148911211295" frame="border" border="1" rules="all"><caption><b>Table 3 </b><strong id="EN-US_TOPIC_0167811967__b1776195582212">tags</strong> field description</caption><thead align="left"><tr id="EN-US_TOPIC_0167811967__row1548971218290"><th align="left" class="cellrowborder" valign="top" width="20.59205920592059%" id="mcps1.3.4.4.2.4.1.1"><p id="EN-US_TOPIC_0167811967__p18102131618297">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="30.583058305830583%" id="mcps1.3.4.4.2.4.1.2"><p id="EN-US_TOPIC_0167811967__p18102016172914">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="48.824882488248825%" id="mcps1.3.4.4.2.4.1.3"><p id="EN-US_TOPIC_0167811967__p710231611294">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0167811967__row13489151252920"><td class="cellrowborder" valign="top" width="20.59205920592059%" headers="mcps1.3.4.4.2.4.1.1 "><p id="EN-US_TOPIC_0167811967__p110291682911">key</p>
</td>
<td class="cellrowborder" valign="top" width="30.583058305830583%" headers="mcps1.3.4.4.2.4.1.2 "><p id="EN-US_TOPIC_0167811967__p610210161292">String</p>
</td>
<td class="cellrowborder" valign="top" width="48.824882488248825%" headers="mcps1.3.4.4.2.4.1.3 "><p id="EN-US_TOPIC_0167811967__p19103716122911">Specifies the tag key.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0167811967__row648971215293"><td class="cellrowborder" valign="top" width="20.59205920592059%" headers="mcps1.3.4.4.2.4.1.1 "><p id="EN-US_TOPIC_0167811967__p101031616132916">value</p>
</td>
<td class="cellrowborder" valign="top" width="30.583058305830583%" headers="mcps1.3.4.4.2.4.1.2 "><p id="EN-US_TOPIC_0167811967__p1510317163290">String</p>
</td>
<td class="cellrowborder" valign="top" width="48.824882488248825%" headers="mcps1.3.4.4.2.4.1.3 "><p id="EN-US_TOPIC_0167811967__p141031016142915">Specifies the tag value.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_section869483985113"><h4 class="sectiontitle">Example Request</h4><p id="EN-US_TOPIC_0167811967__p4238168548">Query all tags of a specified ECS.</p>
<pre class="screen" id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_screen1336311553442">GET https://<em id="EN-US_TOPIC_0167811967__i5452131772714">{endpoint}</em>/v1/{project_id}/cloudservers/{server_id}/tags</pre>
</div>
<div class="section" id="EN-US_TOPIC_0167811967__section11189250192212"><h4 class="sectiontitle">Example Response</h4><pre class="screen" id="EN-US_TOPIC_0167811967__screen12196195022218">{
"tags": [
{
"key": "key1",
"value": "value1"
},
{
"key": "key2",
"value": "value3"
}
]
}</pre>
</div>
<div class="section" id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_en-us_topic_0092803065_en-us_topic_0020212692_section22960139"><h4 class="sectiontitle">Returned Values</h4><p id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_en-us_topic_0092803065_en-us_topic_0020212692_p23670760">See <a href="en-us_topic_0022067716.html">Returned Values for General Requests</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_en-us_topic_0092803065_en-us_topic_0067161469_en-us_topic_0057973179_section23611955"><h4 class="sectiontitle">Error Codes</h4><p id="EN-US_TOPIC_0167811967__en-us_topic_0096282703_p20272163175210">See <a href="en-us_topic_0022067717.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0108433461.html">Tag Management</a></div>
</div>
</div>