doc-exports/docs/dns/api-ref/dns_api_67003.html
Qin Ying, Fan cf1007c84e DNS API 20240223 version
Reviewed-by: Hajba, László Antal <laszlo-antal.hajba@t-systems.com>
Co-authored-by: Qin Ying, Fan <fanqinying@huawei.com>
Co-committed-by: Qin Ying, Fan <fanqinying@huawei.com>
2024-05-16 13:48:49 +00:00

166 lines
13 KiB
HTML

<a name="dns_api_67003"></a><a name="dns_api_67003"></a>
<h1 class="topictitle1">Adding or Deleting Resource Tags in Batches</h1>
<div id="body1532574607836"><div class="section" id="dns_api_67003__section2763065016101"><h4 class="sectiontitle">Function</h4><p id="dns_api_67003__a6ec76b685b6741cfa54337d16e275946">Add or delete tags for a specified resource in batches.</p>
<p id="dns_api_67003__p368222469">You can add up to 20 tags to a resource.</p>
<p id="dns_api_67003__a6cc50969c2c0470e97e5a87684b4b622">The API is idempotent.</p>
<ul id="dns_api_67003__en-us_topic_0094510675_ul48958016016"><li id="dns_api_67003__lb9c7667c51ba4a57a76fde76a2736231">When you are to create tags, if there are duplicate keys in the request body, an error is reported.<p id="dns_api_67003__a9115abbd23ff48fbbc3121a9ce1816a8"><a name="dns_api_67003__lb9c7667c51ba4a57a76fde76a2736231"></a><a name="lb9c7667c51ba4a57a76fde76a2736231"></a>If a to-be-created tag has the same key as an existing tag, the tag will be created and overwrite the existing one.</p>
</li><li id="dns_api_67003__l9a83123dc3aa47518871b23988afdef4">When tags are being deleted and some tags do not exist, the operation is considered successful by default. The character set of the tags will not be checked.</li></ul>
</div>
<div class="section" id="dns_api_67003__section53701671161015"><h4 class="sectiontitle">URI</h4><p id="dns_api_67003__p4113242310593">POST /v2/{project_id}/{resource_type}/{resource_id}/tags/action</p>
<div class="p" id="dns_api_67003__p12852519468">For details, see <a href="#dns_api_67003__table6099729418149">Table 1</a>.
<div class="tablenoborder"><a name="dns_api_67003__table6099729418149"></a><a name="table6099729418149"></a><table cellpadding="4" cellspacing="0" summary="" id="dns_api_67003__table6099729418149" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters in the URI</caption><thead align="left"><tr id="dns_api_67003__rfcbc44a8a46b42f7a3399447cc33e6bc"><th align="left" class="cellrowborder" valign="top" width="22.64%" id="mcps1.3.2.3.2.2.5.1.1"><p id="dns_api_67003__a7a4aca13a83145a7b874bba426d18c4c"><strong id="dns_api_67003__b1923392311715">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.37%" id="mcps1.3.2.3.2.2.5.1.2"><p id="dns_api_67003__a8c3f3314bb0c42509b058a1de0687bf7"><strong>Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.349999999999998%" id="mcps1.3.2.3.2.2.5.1.3"><p id="dns_api_67003__a274153726c4f4e068d17da9d20adb07a"><strong>Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="42.64%" id="mcps1.3.2.3.2.2.5.1.4"><p id="dns_api_67003__en-us_topic_0123440237_p517246718149"><strong id="dns_api_67003__b81013248712">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="dns_api_67003__r4012eb0589df431685512c63766dd227"><td class="cellrowborder" valign="top" width="22.64%" headers="mcps1.3.2.3.2.2.5.1.1 "><p id="dns_api_67003__a1aec9468ac3740a592e230ea8946b4a0">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.37%" headers="mcps1.3.2.3.2.2.5.1.2 "><p id="dns_api_67003__ac76f20b1516e4b15a400cc05c5c7ce34">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.349999999999998%" headers="mcps1.3.2.3.2.2.5.1.3 "><p id="dns_api_67003__a2d2fc344bf1b429dae66d8e374fa2ed0">String</p>
</td>
<td class="cellrowborder" valign="top" width="42.64%" headers="mcps1.3.2.3.2.2.5.1.4 "><p id="dns_api_67003__a89702749d7e341b79567331aeb131cb1">Project ID. You can obtain it in <a href="dns_api_80007.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
<tr id="dns_api_67003__r12097de3a65e4af7996e768bb2f012f7"><td class="cellrowborder" valign="top" width="22.64%" headers="mcps1.3.2.3.2.2.5.1.1 "><p id="dns_api_67003__a83d50bdf8f0147428c4bd7d748d16f3e">resource_type</p>
</td>
<td class="cellrowborder" valign="top" width="17.37%" headers="mcps1.3.2.3.2.2.5.1.2 "><p id="dns_api_67003__ad4ecbc7d4a34452f86a5163504ee39ea">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.349999999999998%" headers="mcps1.3.2.3.2.2.5.1.3 "><p id="dns_api_67003__a8c89d349f80447ff996ebe69a283837a">String</p>
</td>
<td class="cellrowborder" valign="top" width="42.64%" headers="mcps1.3.2.3.2.2.5.1.4 "><p id="dns_api_67003__p1987845714378">Resource type.</p>
<ul id="dns_api_67003__ul3997124517225"><li id="dns_api_67003__dns_api_67001_li166466010217">DNS-public_zone</li><li id="dns_api_67003__dns_api_67001_li1264680132118">DNS-private_zone</li><li id="dns_api_67003__dns_api_67001_li136469010215">DNS-public_recordset</li><li id="dns_api_67003__dns_api_67001_li176467015215">DNS-private_recordset</li><li id="dns_api_67003__dns_api_67001_li126461909212">DNS-ptr_record</li></ul>
</td>
</tr>
<tr id="dns_api_67003__r959a126496424428b274abddaf342841"><td class="cellrowborder" valign="top" width="22.64%" headers="mcps1.3.2.3.2.2.5.1.1 "><p id="dns_api_67003__en-us_topic_0123440237_p408654311220">resource_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.37%" headers="mcps1.3.2.3.2.2.5.1.2 "><p id="dns_api_67003__a8eaeadb4d70e418281a8f66c9e7f5039">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.349999999999998%" headers="mcps1.3.2.3.2.2.5.1.3 "><p id="dns_api_67003__a9656fece8a6142d2889a5fd15e6e354a">String</p>
</td>
<td class="cellrowborder" valign="top" width="42.64%" headers="mcps1.3.2.3.2.2.5.1.4 "><p id="dns_api_67003__a74c281cde6aa47fbad1fdc186589692d">Resource ID</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="dns_api_67003__section44958995161021"><h4 class="sectiontitle">Request</h4><ul id="dns_api_67003__ud9ab2e930608497a8b80226dfb3b34ad"><li id="dns_api_67003__l30ff05631e7041dcb33b555aec89bcc0">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dns_api_67003__ta8e34d2abfab47aa998529cacfcb2828" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameters in the request</caption><thead align="left"><tr id="dns_api_67003__rcd93df91505146de937d43e19d340f2f"><th align="left" class="cellrowborder" valign="top" width="22.45%" id="mcps1.3.3.2.1.1.2.5.1.1"><p id="dns_api_67003__en-us_topic_0094510675_p3415211830"><strong>Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="12.78%" id="mcps1.3.3.2.1.1.2.5.1.2"><p id="dns_api_67003__en-us_topic_0094510675_p276632601830"><strong>Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="22.05%" id="mcps1.3.3.2.1.1.2.5.1.3"><p id="dns_api_67003__en-us_topic_0094510675_p261316001830"><strong>Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="42.72%" id="mcps1.3.3.2.1.1.2.5.1.4"><p id="dns_api_67003__en-us_topic_0094510675_p362848191830"><strong>Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="dns_api_67003__r1dae0bc4b85446b8a56f30ada7a63fe8"><td class="cellrowborder" valign="top" width="22.45%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="dns_api_67003__a79af0cb72c174d3ca1f428eecec90c40">tags</p>
</td>
<td class="cellrowborder" valign="top" width="12.78%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="dns_api_67003__en-us_topic_0094510675_p458022581830">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="22.05%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="dns_api_67003__p10319350151213">Array of object</p>
</td>
<td class="cellrowborder" valign="top" width="42.72%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="dns_api_67003__ae2ca2f7ad13b4f58bb7996f0a46dd61b">Tag list. The tag list structure cannot be empty when you delete tags. For details, see <a href="#dns_api_67003__t4b1b8c5089e8440eb9e241650e1b469f">Table 3</a>.</p>
</td>
</tr>
<tr id="dns_api_67003__r83eaea44319f4fb2a961371d118330ea"><td class="cellrowborder" valign="top" width="22.45%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="dns_api_67003__a10c775ff12944ab5b2d46801393db0b0">action</p>
</td>
<td class="cellrowborder" valign="top" width="12.78%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="dns_api_67003__en-us_topic_0094510675_p349520711830">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="22.05%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="dns_api_67003__en-us_topic_0094510675_p125455181830">String</p>
</td>
<td class="cellrowborder" valign="top" width="42.72%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="dns_api_67003__aaf692f79fda9478ca778f9b1a4a4495f">Operation, which can be <strong id="dns_api_67003__b842352706163653">create</strong> or <strong id="dns_api_67003__b842352706163656">delete</strong> (case sensitive)</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="dns_api_67003__t4b1b8c5089e8440eb9e241650e1b469f"></a><a name="t4b1b8c5089e8440eb9e241650e1b469f"></a><table cellpadding="4" cellspacing="0" summary="" id="dns_api_67003__t4b1b8c5089e8440eb9e241650e1b469f" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Parameters in the <strong id="dns_api_67003__b107344529714">tags</strong> field</caption><thead align="left"><tr id="dns_api_67003__r86189205e3ee41529729d61f18ec04d1"><th align="left" class="cellrowborder" valign="top" width="22.36%" id="mcps1.3.3.2.1.2.2.5.1.1"><p id="dns_api_67003__a45f786a4d2ca490587c55a81a7af4ad7"><strong>Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.21%" id="mcps1.3.3.2.1.2.2.5.1.2"><p id="dns_api_67003__ab5aaec07a65a48ddad37de74a8cd214c"><strong>Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.46%" id="mcps1.3.3.2.1.2.2.5.1.3"><p id="dns_api_67003__a3c87a997c67f4f78a6279bfa660fa467"><strong>Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45.97%" id="mcps1.3.3.2.1.2.2.5.1.4"><p id="dns_api_67003__ae574633cb32142cb8a86070dabb6e9b9"><strong>Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="dns_api_67003__r78fd46051cda489982fda24f1fdf4c1c"><td class="cellrowborder" valign="top" width="22.36%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="dns_api_67003__a528be4079abd420192e1494e05b1398d">key</p>
</td>
<td class="cellrowborder" valign="top" width="15.21%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="dns_api_67003__afa35bdbbfed2435a805a1d905e68766a">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.46%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="dns_api_67003__a1487b792e22f4d6caa93834823baa0e3">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.97%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="dns_api_67003__p011410211144">Tag key</p>
<p id="dns_api_67003__p12621122816413">A key can contain up to 36 Unicode characters. The key cannot be empty. </p>
</td>
</tr>
<tr id="dns_api_67003__reaee45c981d34f85b4810a8fb8325ec6"><td class="cellrowborder" valign="top" width="22.36%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="dns_api_67003__ae13982a9b00045288249e98ebf57b395">value</p>
</td>
<td class="cellrowborder" valign="top" width="15.21%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="dns_api_67003__a99da8193a7584036baec00bb32a65183">No</p>
</td>
<td class="cellrowborder" valign="top" width="16.46%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="dns_api_67003__a3d072237ebc14c6ca7b298459384d363">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.97%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="dns_api_67003__p592417401420">Tag value</p>
<p id="dns_api_67003__p3383124915419">Each value can contain up to 43 Unicode characters and can be an empty string. </p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="dns_api_67003__lb8475c7657084bc1b4a8b5c9bdd2c68e">Example request<div class="p" id="dns_api_67003__p3278158164817"><a name="dns_api_67003__lb8475c7657084bc1b4a8b5c9bdd2c68e"></a><a name="lb8475c7657084bc1b4a8b5c9bdd2c68e"></a>Add and delete tags for the private zone whose ID is ff8080825b8fc86c015b94bc6f8712c3:<pre class="codeblock" id="dns_api_67003__codeblock71681155174817">POST https://{DNS_Endpoint}/v2/{project_id}/DNS-private_zone/ff8080825b8fc86c015b94bc6f8712c3/tags/action</pre>
</div>
<div class="p" id="dns_api_67003__p1116845514484"><pre class="screen" id="dns_api_67003__screen11168105519483">{
"action": "create",
"tags": [
{
"key": "key1",
"value": "value1"
},
{
"key": "key2",
"value": "value2"
}
]
}
</pre>
</div>
<p id="dns_api_67003__p175672019548">or</p>
<pre class="screen" id="dns_api_67003__screen153441045125312">{
"action": "delete",
"tags": [
{
"key": "key1",
"value": "value1"
},
{
"key": "key2",
"value": "value2"
}
]
}</pre>
</li></ul>
</div>
<div class="section" id="dns_api_67003__section40090803161031"><h4 class="sectiontitle">Response</h4><p id="dns_api_67003__a9d3299c3cb0f4689be24a912d07192b3">None</p>
</div>
<div class="section" id="dns_api_67003__section9249181042119"><h4 class="sectiontitle">Returned Value</h4><p id="dns_api_67003__dns_api_61001_p711102924515">If a 2xx status code is returned, for example, 200, 202, or 204, the request is successful.</p>
<p id="dns_api_67003__dns_api_61001_p18506102624518">For details, see <a href="dns_api_80002.html">Status Code</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dns_api_67000.html">Tag Management</a></div>
</div>
</div>