doc-exports/docs/dds/api-ref/dds_api_0033.html
Wang , Deng Ke 60010eb9d0 dds api 2.0.38sp24 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Wang , Deng Ke <wangdengke2@huawei.com>
Co-committed-by: Wang , Deng Ke <wangdengke2@huawei.com>
2023-01-13 08:55:41 +00:00

156 lines
12 KiB
HTML

<a name="dds_api_0033"></a><a name="dds_api_0033"></a>
<h1 class="topictitle1">Adding or Deleting Resource Tags in Batches</h1>
<div id="body8662426"><div class="section" id="dds_api_0033__section028518125549"><h4 class="sectiontitle">Function</h4><p id="dds_api_0033__p11549121210545">This API is used to add or delete tags of the specified instance in batches.</p>
</div>
<div class="section" id="dds_api_0033__section19812493810"><h4 class="sectiontitle">Constraints</h4><ul id="dds_api_0033__ul2086914232217"><li id="dds_api_0033__li198691523112116">A maximum of 20 tags can be added to a DB instance. The tag key must be unique.<ul id="dds_api_0033__ul1230735881513"><li id="dds_api_0033__li5869152342119">If the request body contains duplicated keys, an error message will be reported when the API is called.</li><li id="dds_api_0033__li98691323182115">If the key in the request body is the same as an existing key in the specified instance, the value of the <strong id="dds_api_0033__b16909165425013">value</strong> parameter that corresponds to the existing key is overwritten.</li></ul>
</li><li id="dds_api_0033__li1182019308178">If tags to be deleted do not exist, the operation is considered to be successful by default. The character set of the tags will not be checked. The tag structure in the request body cannot be missing, and the key cannot be left blank or an empty string.</li></ul>
</div>
<div class="section" id="dds_api_0033__section229191265410"><h4 class="sectiontitle">URI</h4><ul id="dds_api_0033__ul1654921235412"><li id="dds_api_0033__li75491812185415">URI format<p id="dds_api_0033__p1454915125543"><a name="dds_api_0033__li75491812185415"></a><a name="li75491812185415"></a>POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/tags/action</p>
</li><li id="dds_api_0033__li11549512135412">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dds_api_0033__table53181120545" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="dds_api_0033__row11549131235414"><th align="left" class="cellrowborder" valign="top" width="22.220000000000002%" id="mcps1.3.3.2.2.1.2.4.1.1"><p id="dds_api_0033__p3549612135411">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.16%" id="mcps1.3.3.2.2.1.2.4.1.2"><p id="dds_api_0033__p1154961235416">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="61.62%" id="mcps1.3.3.2.2.1.2.4.1.3"><p id="dds_api_0033__p2775334615440">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dds_api_0033__row1854991211541"><td class="cellrowborder" valign="top" width="22.220000000000002%" headers="mcps1.3.3.2.2.1.2.4.1.1 "><p id="dds_api_0033__p754901219542">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.3.2.2.1.2.4.1.2 "><p id="dds_api_0033__p0549191218548">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.62%" headers="mcps1.3.3.2.2.1.2.4.1.3 "><p id="dds_api_0033__p654951215420">Specifies the project ID of a tenant in a region.</p>
</td>
</tr>
<tr id="dds_api_0033__row55491912185417"><td class="cellrowborder" valign="top" width="22.220000000000002%" headers="mcps1.3.3.2.2.1.2.4.1.1 "><p id="dds_api_0033__p14549512165418">instance_id</p>
</td>
<td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.3.2.2.1.2.4.1.2 "><p id="dds_api_0033__p1654921217542">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.62%" headers="mcps1.3.3.2.2.1.2.4.1.3 "><p id="dds_api_0033__p1754971211544">Specifies the instance ID, which can be obtained by calling the API for querying instances. If you do not have an instance, you can call the API used for creating an instance.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="dds_api_0033__section2327151245418"><h4 class="sectiontitle">Requests</h4><ul id="dds_api_0033__ul955117126542"><li id="dds_api_0033__li1655119124549">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dds_api_0033__table18331131245417" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description</caption><thead align="left"><tr id="dds_api_0033__row555121285416"><th align="left" class="cellrowborder" valign="top" width="20.897910208979102%" id="mcps1.3.4.2.1.1.2.5.1.1"><p id="dds_api_0033__p1551412195410">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.98830116988301%" id="mcps1.3.4.2.1.1.2.5.1.2"><p id="dds_api_0033__p25516128542">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.6979302069793%" id="mcps1.3.4.2.1.1.2.5.1.3"><p id="dds_api_0033__p15551181245415">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="41.415858414158585%" id="mcps1.3.4.2.1.1.2.5.1.4"><p id="dds_api_0033__p755713117612">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dds_api_0033__row1346957142214"><td class="cellrowborder" valign="top" width="20.897910208979102%" headers="mcps1.3.4.2.1.1.2.5.1.1 "><p id="dds_api_0033__p189661243230">action</p>
</td>
<td class="cellrowborder" valign="top" width="16.98830116988301%" headers="mcps1.3.4.2.1.1.2.5.1.2 "><p id="dds_api_0033__p18976848235">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20.6979302069793%" headers="mcps1.3.4.2.1.1.2.5.1.3 "><p id="dds_api_0033__p119793416232">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.415858414158585%" headers="mcps1.3.4.2.1.1.2.5.1.4 "><p id="dds_api_0033__p1087621992316">Specifies the operation identifier. Valid value:</p>
<ul id="dds_api_0033__ul197221552122319"><li id="dds_api_0033__li472216525234"><strong id="dds_api_0033__b84235270611286">create</strong>: indicates to add tags.</li><li id="dds_api_0033__li147229524231"><strong id="dds_api_0033__b84235270611295">delete</strong>: indicates to delete tags.</li></ul>
</td>
</tr>
<tr id="dds_api_0033__row195514128543"><td class="cellrowborder" valign="top" width="20.897910208979102%" headers="mcps1.3.4.2.1.1.2.5.1.1 "><p id="dds_api_0033__p1255120120545">tags</p>
</td>
<td class="cellrowborder" valign="top" width="16.98830116988301%" headers="mcps1.3.4.2.1.1.2.5.1.2 "><p id="dds_api_0033__p9551151211544">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20.6979302069793%" headers="mcps1.3.4.2.1.1.2.5.1.3 "><p id="dds_api_0033__p152220582592">Array of objects</p>
</td>
<td class="cellrowborder" valign="top" width="41.415858414158585%" headers="mcps1.3.4.2.1.1.2.5.1.4 "><p id="dds_api_0033__p2551171215414">Specifies the tag list. For more information, see <a href="#dds_api_0033__table19347161295418">Table 3</a>.</p>
<div class="note" id="dds_api_0033__note2051013033811"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="dds_api_0033__p1751163073814">When you delete tags, do not check the character set of this parameter.</p>
</div></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="dds_api_0033__table19347161295418"></a><a name="table19347161295418"></a><table cellpadding="4" cellspacing="0" summary="" id="dds_api_0033__table19347161295418" frame="border" border="1" rules="all"><caption><b>Table 3 </b>tags field data structure description</caption><thead align="left"><tr id="dds_api_0033__row855112129541"><th align="left" class="cellrowborder" valign="top" width="21.08789121087891%" id="mcps1.3.4.2.1.2.2.5.1.1"><p id="dds_api_0033__p355131215546">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.88831116888311%" id="mcps1.3.4.2.1.2.2.5.1.2"><p id="dds_api_0033__p175515121544">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.50794920507949%" id="mcps1.3.4.2.1.2.2.5.1.3"><p id="dds_api_0033__p155111127546">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="41.51584841515849%" id="mcps1.3.4.2.1.2.2.5.1.4"><p id="dds_api_0033__p96941351961">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dds_api_0033__row20552212135415"><td class="cellrowborder" valign="top" width="21.08789121087891%" headers="mcps1.3.4.2.1.2.2.5.1.1 "><p id="dds_api_0033__p20552101285419">key</p>
</td>
<td class="cellrowborder" valign="top" width="16.88831116888311%" headers="mcps1.3.4.2.1.2.2.5.1.2 "><p id="dds_api_0033__p1255214120542">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20.50794920507949%" headers="mcps1.3.4.2.1.2.2.5.1.3 "><p id="dds_api_0033__p9552131220545">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.51584841515849%" headers="mcps1.3.4.2.1.2.2.5.1.4 "><p id="dds_api_0033__p1625715267409">Specifies the tag key. It contains a maximum of 36 Unicode characters. It cannot be null or an empty string or contain spaces. Before verifying and using <strong id="dds_api_0033__b1796745416716">key</strong>, spaces are automatically filtered out.</p>
<p id="dds_api_0033__p28901137142810">Character set: 0-9, A-Z, a-z, "_", "-", and "@".</p>
</td>
</tr>
<tr id="dds_api_0033__row1755214129548"><td class="cellrowborder" valign="top" width="21.08789121087891%" headers="mcps1.3.4.2.1.2.2.5.1.1 "><p id="dds_api_0033__p175521612115410">value</p>
</td>
<td class="cellrowborder" valign="top" width="16.88831116888311%" headers="mcps1.3.4.2.1.2.2.5.1.2 "><p id="dds_api_0033__p255271235413">No</p>
</td>
<td class="cellrowborder" valign="top" width="20.50794920507949%" headers="mcps1.3.4.2.1.2.2.5.1.3 "><p id="dds_api_0033__p17552512195420">String</p>
</td>
<td class="cellrowborder" valign="top" width="41.51584841515849%" headers="mcps1.3.4.2.1.2.2.5.1.4 "><p id="dds_api_0033__p39216418312">Specifies the tag value. It contains a maximum of 43 Unicode characters, can be an empty string, and cannot contain spaces. Before verifying or using <strong id="dds_api_0033__b16775151824214">value</strong>, spaces are automatically filtered out.</p>
<p id="dds_api_0033__p144961912132510">Character set: 0-9, A-Z, a-z, "_", "-", and "@".</p>
<ul id="dds_api_0033__ul3538650143112"><li id="dds_api_0033__li11538950143114">If <strong id="dds_api_0033__b9223137080">action</strong> is set to <strong id="dds_api_0033__b61509102815">create</strong>, this parameter is mandatory.</li><li id="dds_api_0033__li1953825013315">If <strong id="dds_api_0033__b1673613429814">action</strong> is set to <strong id="dds_api_0033__b118799441088">delete</strong>, this parameter is optional.<div class="note" id="dds_api_0033__note157512569365"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="dds_api_0033__p1175355610362">If <strong id="dds_api_0033__b84235270611421">value</strong> is specified, tags are deleted by key and value. If <strong id="dds_api_0033__b842352706114252">value</strong> is not specified, tags are deleted by key.</p>
</div></div>
</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<ul id="dds_api_0033__ul1855341218544"><li id="dds_api_0033__li1558313499207">Example request<p id="dds_api_0033__p895334318185"><a name="dds_api_0033__li1558313499207"></a><a name="li1558313499207"></a>POST https://dds.eu-de.otc.t-systems.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/cc6345c64cec47499182467ea0dd432ain02/tags/action</p>
<p id="dds_api_0033__p42141648125912"></p>
<p id="dds_api_0033__p184611135115912">Add tags.</p>
<pre class="codeblock" id="dds_api_0033__codeblock246253515916">{
"action": "create",
"tags": [
{
"key": "key1",
"value": "value1"
},
{
"key": "key",
"value": "value3"
}
]
}</pre>
<p id="dds_api_0033__p046213545920">Delete tags.</p>
<pre class="codeblock" id="dds_api_0033__codeblock1346214358592">{
"action": "delete",
"tags": [
{
"key": "key1"
},
{
"key": "key2",
"value": "value3"
}
]
}</pre>
</li></ul>
</div>
<div class="section" id="dds_api_0033__section337921210548"><h4 class="sectiontitle">Responses</h4><pre class="codeblock" id="dds_api_0033__codeblock480372914218">{}</pre>
</div>
<div class="section" id="dds_api_0033__section5382712154838"><h4 class="sectiontitle">Status Code</h4><p id="dds_api_0033__dds_api_0018_p16131712193312">Status Code:200.</p>
<p id="dds_api_0033__dds_api_0018_p480617135329">For more information, see <a href="dds_status_code.html">Status Code</a>.</p>
</div>
<div class="section" id="dds_api_0033__section6522193710339"><h4 class="sectiontitle">Error Code</h4><p id="dds_api_0033__dds_api_0018_p20466124120334">For more information, see <a href="dds_error_code.html">Error Code</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dds_tag_mgmt.html">Tag Management</a></div>
</div>
</div>