doc-exports/docs/ecs/api-ref/en-us_topic_0065820822.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

78 lines
7.1 KiB
HTML

<a name="EN-US_TOPIC_0065820822"></a><a name="EN-US_TOPIC_0065820822"></a>
<h1 class="topictitle1">Querying Tags of an <span id="text1594785317558">ECS</span></h1>
<div id="body1499653398050"><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_p5405340">This API is used to query all tags of an <span id="EN-US_TOPIC_0065820822__text3114719491">ECS</span>.</p>
<p id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_p58041982596">You are required to use the HTTP header <strong id="EN-US_TOPIC_0065820822__b842352706165643">X-OpenStack-Nova-API-Version: 2.26</strong> to specify the microversion on the client.</p>
<div class="section" id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_section48648066"><h4 class="sectiontitle">URI</h4><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_p17816132418199">GET /v2.1/{project_id}/servers/{server_id}/tags</p>
<div class="p" id="EN-US_TOPIC_0065820822__p18281739112210"><a href="#EN-US_TOPIC_0065820822__en-us_topic_0057972837_table32475667">Table 1</a> describes the parameters in the URI.
<div class="tablenoborder"><a name="EN-US_TOPIC_0065820822__en-us_topic_0057972837_table32475667"></a><a name="en-us_topic_0057972837_table32475667"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_table32475667" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_row44937496"><th align="left" class="cellrowborder" valign="top" width="22.24%" id="mcps1.3.3.3.2.2.4.1.1"><p id="EN-US_TOPIC_0065820822__p5187119">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21.87%" id="mcps1.3.3.3.2.2.4.1.2"><p id="EN-US_TOPIC_0065820822__p17503500">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="55.88999999999999%" id="mcps1.3.3.3.2.2.4.1.3"><p id="EN-US_TOPIC_0065820822__p8497414">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_row1664874"><td class="cellrowborder" valign="top" width="22.24%" headers="mcps1.3.3.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_p637140">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="21.87%" headers="mcps1.3.3.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_p51608407">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.88999999999999%" headers="mcps1.3.3.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0065820822__p37593705">Specifies the project ID.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_row41565035"><td class="cellrowborder" valign="top" width="22.24%" headers="mcps1.3.3.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_p11324657">server_id</p>
</td>
<td class="cellrowborder" valign="top" width="21.87%" headers="mcps1.3.3.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_p44882061">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="55.88999999999999%" headers="mcps1.3.3.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_p11568292">Specifies the <span id="EN-US_TOPIC_0065820822__text17713753018">ECS</span> ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_section35179415"><h4 class="sectiontitle">Request</h4><p id="EN-US_TOPIC_0065820822__p19111859196">None</p>
</div>
<div class="section" id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_section1485113257556"><h4 class="sectiontitle">Response</h4><p id="EN-US_TOPIC_0065820822__p1098419444235"><a href="#EN-US_TOPIC_0065820822__en-us_topic_0057972838_table28387752">Table 2</a> describes the response parameters.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0065820822__en-us_topic_0057972838_table28387752"></a><a name="en-us_topic_0057972838_table28387752"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0065820822__en-us_topic_0057972838_table28387752" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Response parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0065820822__en-us_topic_0057972838_row66802302"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.5.3.2.4.1.1"><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972838_p42277343">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18%" id="mcps1.3.5.3.2.4.1.2"><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972838_p1912753">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="65%" id="mcps1.3.5.3.2.4.1.3"><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972838_p217030">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0065820822__en-us_topic_0057972838_row17579482"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.5.3.2.4.1.1 "><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972838_p14651901">tags</p>
</td>
<td class="cellrowborder" valign="top" width="18%" headers="mcps1.3.5.3.2.4.1.2 "><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972838_p45953370">Array of strings</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.3.2.4.1.3 "><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972838_p47045852">Specifies <span id="EN-US_TOPIC_0065820822__text07151057145520">ECS</span> tags.</p>
<p id="EN-US_TOPIC_0065820822__p7300949059">Tag functions have been upgraded on the cloud platform. After the upgrade, the tag values returned by the system comply with the following rules:</p>
<ul id="EN-US_TOPIC_0065820822__ul871515496611"><li id="EN-US_TOPIC_0065820822__li5715249264">The key and value of a tag are connected using an equal sign (=), for example, key=value.</li><li id="EN-US_TOPIC_0065820822__li571513498613">If the value is empty, only the key is returned.</li></ul>
<p id="EN-US_TOPIC_0065820822__p141334271371">For more details about upgraded tag functions, see <a href="en-us_topic_0065817686.html">Tag Types</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0065820822__section14532216125819"><h4 class="sectiontitle">Example Request</h4><p id="EN-US_TOPIC_0065820822__p19291125414916">Query all tags attached to a specified ECS.</p>
<pre class="screen" id="EN-US_TOPIC_0065820822__screen11441196203720">GET https://{endpoint}/v2.1/{project_id}/servers/{server_id}/tags</pre>
</div>
<div class="section" id="EN-US_TOPIC_0065820822__section1956815525910"><h4 class="sectiontitle">Example Response</h4><div class="p" id="EN-US_TOPIC_0065820822__p55351725145813">Example response<pre class="screen" id="EN-US_TOPIC_0065820822__screen1656825217919">{
"tags": ["baz=xyy", "foo", "qux"]
}</pre>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_en-us_topic_0020212692_section22960139"><h4 class="sectiontitle">Returned Values</h4><p id="EN-US_TOPIC_0065820822__en-us_topic_0057972837_en-us_topic_0020212692_p23670760">See <a href="en-us_topic_0022067716.html">Returned Values for General Requests</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0108433460.html">Tag Management</a></div>
</div>
</div>