doc-exports/docs/ims/api-ref/en-us_topic_0020092111.html
Zaoxu, Li fdf6843d7a ims_api1226
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-01-11 14:47:14 +00:00

104 lines
8.6 KiB
HTML

<a name="EN-US_TOPIC_0020092111"></a><a name="EN-US_TOPIC_0020092111"></a>
<h1 class="topictitle1">Adding a Tag (Native OpenStack API)</h1>
<div id="body26973745"><div class="section" id="EN-US_TOPIC_0020092111__section43944024"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0020092111__p37389755">This API is used to add a custom tag to an image. With tags, you can manage easily the images.</p>
</div>
<div class="section" id="EN-US_TOPIC_0020092111__section59951903"><h4 class="sectiontitle">URI</h4><p id="EN-US_TOPIC_0020092111__p587088331724">PUT /v2/images/{image_id}/tags/{tag}</p>
<div class="p" id="EN-US_TOPIC_0020092111__p27519118313"><a href="#EN-US_TOPIC_0020092111__table58396974">Table 1</a> lists the parameters in the URI.
<div class="tablenoborder"><a name="EN-US_TOPIC_0020092111__table58396974"></a><a name="table58396974"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0020092111__table58396974" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0020092111__row52161898"><th align="left" class="cellrowborder" valign="top" width="20.49%" id="mcps1.3.2.3.2.2.5.1.1"><p id="EN-US_TOPIC_0020092111__p64364196"><strong id="EN-US_TOPIC_0020092111__b29862858161838">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.68%" id="mcps1.3.2.3.2.2.5.1.2"><p id="EN-US_TOPIC_0020092111__p40455902205623"><strong id="EN-US_TOPIC_0020092111__b31324481161845">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="23.119999999999997%" id="mcps1.3.2.3.2.2.5.1.3"><p id="EN-US_TOPIC_0020092111__p46117407">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="35.709999999999994%" id="mcps1.3.2.3.2.2.5.1.4"><p id="EN-US_TOPIC_0020092111__p44522499">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0020092111__row49552630"><td class="cellrowborder" valign="top" width="20.49%" headers="mcps1.3.2.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0020092111__p54340131">image_id</p>
</td>
<td class="cellrowborder" valign="top" width="20.68%" headers="mcps1.3.2.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0020092111__p15622373205623">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="23.119999999999997%" headers="mcps1.3.2.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0020092111__p39474480">String</p>
</td>
<td class="cellrowborder" valign="top" width="35.709999999999994%" headers="mcps1.3.2.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0020092111__p43316293">Specifies the image ID.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0020092111__row54302323"><td class="cellrowborder" valign="top" width="20.49%" headers="mcps1.3.2.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0020092111__p36412008">tag</p>
</td>
<td class="cellrowborder" valign="top" width="20.68%" headers="mcps1.3.2.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0020092111__p47312118205623">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="23.119999999999997%" headers="mcps1.3.2.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0020092111__p63691513">String</p>
</td>
<td class="cellrowborder" valign="top" width="35.709999999999994%" headers="mcps1.3.2.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0020092111__p75636161112">Specifies the tag to be added.</p>
<p id="EN-US_TOPIC_0020092111__p15777461117">The tag can contain only digits, letters, underscores (_), and hyphens (-).</p>
<div class="note" id="EN-US_TOPIC_0020092111__note1350761815387"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="EN-US_TOPIC_0020092111__p550721883817">This API can only be used to add a tag key. To add a tag value, use the PUT /v1/cloudimages/tags API. For details, see <a href="en-us_topic_0067360381.html">Adding or Modifying a Tag</a>.</p>
</div></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0020092111__section2696221"><h4 class="sectiontitle">Request</h4><p id="EN-US_TOPIC_0020092111__p19131145619513">Request parameters</p>
<p id="EN-US_TOPIC_0020092111__p1898504328">None</p>
</div>
<div class="section" id="EN-US_TOPIC_0020092111__section2034812610311"><h4 class="sectiontitle">Example Request</h4><p id="EN-US_TOPIC_0020092111__p19279319175113">Adding an image tag</p>
<pre class="screen" id="EN-US_TOPIC_0020092111__screen1196517296316">PUT https://{Endpoint}/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba90/tags/aaaa</pre>
</div>
<div class="section" id="EN-US_TOPIC_0020092111__section24265995"><h4 class="sectiontitle">Response</h4><ul id="EN-US_TOPIC_0020092111__ul263811719324"><li id="EN-US_TOPIC_0020092111__li186381775327">Response parameters<p id="EN-US_TOPIC_0020092111__p166572319328"><a name="EN-US_TOPIC_0020092111__li186381775327"></a><a name="li186381775327"></a>None</p>
</li><li id="EN-US_TOPIC_0020092111__li8765181115321">Example response<pre class="codeblock" id="EN-US_TOPIC_0020092111__codeblock52928864162419">STATUS CODE 204</pre>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0020092111__section17067371"><h4 class="sectiontitle">Returned Values</h4><ul id="EN-US_TOPIC_0020092111__ul33868853"><li id="EN-US_TOPIC_0020092111__li36384226">Normal<p id="EN-US_TOPIC_0020092111__p59022586"><a name="EN-US_TOPIC_0020092111__li36384226"></a><a name="li36384226"></a>204</p>
</li><li id="EN-US_TOPIC_0020092111__li61441228">Abnormal
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0020092111__table642803117411" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0020092111__row109645217411"><th align="left" class="cellrowborder" valign="top" width="38.080000000000005%" id="mcps1.3.6.2.2.1.1.3.1.1"><p id="EN-US_TOPIC_0020092111__p2170376317411">Returned Value</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="61.919999999999995%" id="mcps1.3.6.2.2.1.1.3.1.2"><p id="EN-US_TOPIC_0020092111__p1317436717411"><strong id="EN-US_TOPIC_0020092111__b5047798416190">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0020092111__row6049076717411"><td class="cellrowborder" valign="top" width="38.080000000000005%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0020092111__p80506717411">400 Bad Request</p>
</td>
<td class="cellrowborder" valign="top" width="61.919999999999995%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0020092111__p6521049217411">Request error.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0020092111__row5002352417411"><td class="cellrowborder" valign="top" width="38.080000000000005%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0020092111__p2537366317411">401 Unauthorized</p>
</td>
<td class="cellrowborder" valign="top" width="61.919999999999995%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0020092111__p4200083517411">Authentication failed.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0020092111__row4246319517411"><td class="cellrowborder" valign="top" width="38.080000000000005%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0020092111__p1696676617411">403 Forbidden</p>
</td>
<td class="cellrowborder" valign="top" width="61.919999999999995%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0020092111__p3213081417411">You do not have the rights to perform the operation.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0020092111__row22446538192234"><td class="cellrowborder" valign="top" width="38.080000000000005%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0020092111__p2466565192236">404 Not Found</p>
</td>
<td class="cellrowborder" valign="top" width="61.919999999999995%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0020092111__p65574046192236">The requested resource was not found.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0020092111__row2074187217411"><td class="cellrowborder" valign="top" width="38.080000000000005%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0020092111__p237005317411">500 Internal Server Error</p>
</td>
<td class="cellrowborder" valign="top" width="61.919999999999995%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0020092111__p5775661917411">Internal service error.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0020092111__row5004752817411"><td class="cellrowborder" valign="top" width="38.080000000000005%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0020092111__p2731794517411">503 Service Unavailable</p>
</td>
<td class="cellrowborder" valign="top" width="61.919999999999995%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0020092111__p6526996817411">The service is unavailable.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0122410335.html">Image Tagging (Native OpenStack APIs)</a></div>
</div>
</div>