forked from docs/doc-exports
Reviewed-by: Bobkova, Natalia <natalia.bobkova@t-systems.com> Co-authored-by: Zaoxu, Li <lizaoxu@huawei.com> Co-committed-by: Zaoxu, Li <lizaoxu@huawei.com>
171 lines
14 KiB
HTML
171 lines
14 KiB
HTML
<a name="smn_api_56002"></a><a name="smn_api_56002"></a>
|
|
|
|
<h1 class="topictitle1">Adding or Deleting Tags in Batches</h1>
|
|
<div id="body1523350913840"><div class="section" id="smn_api_56002__section11166154101819"><h4 class="sectiontitle">Description</h4><ul id="smn_api_56002__ul4619132192719"><li id="smn_api_56002__li7619153252712">API name<p id="smn_api_56002__p1160318578274"><a name="smn_api_56002__li7619153252712"></a><a name="li7619153252712"></a>BatchCreateOrDeleteResourceTags</p>
|
|
</li><li id="smn_api_56002__li13728183962718">Function<p id="smn_api_56002__p1063411548188"><a name="smn_api_56002__li13728183962718"></a><a name="li13728183962718"></a>Add or delete tags for a specified topic in batches.</p>
|
|
<p id="smn_api_56002__p1663642517323">You can add a maximum of 20 tags to a resource.</p>
|
|
<div class="note" id="smn_api_56002__note38901949191911"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="smn_api_56002__p15634125481814">The API is idempotent. When you are to create tags, if there are duplicate keys in the request body, an error is reported.</p>
|
|
<p id="smn_api_56002__p96344545184">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>
|
|
<p id="smn_api_56002__p287405491919">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.</p>
|
|
</div></div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_56002__section171812054161811"><h4 class="sectiontitle">URI</h4><ul id="smn_api_56002__ul1463418547181"><li id="smn_api_56002__li063413540188">URI format<p id="smn_api_56002__p12634155481813"><a name="smn_api_56002__li063413540188"></a><a name="li063413540188"></a>POST /v2/{project_id}/{resource_type}/{resource_id}/tags/action</p>
|
|
</li><li id="smn_api_56002__li1563445419187">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_56002__table4181105410187" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_56002__row9634205461818"><th align="left" class="cellrowborder" valign="top" width="22.972297229722972%" id="mcps1.3.2.2.2.1.1.5.1.1"><p id="smn_api_56002__p13634105451820"><strong id="smn_api_56002__b842352706191030">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="22.972297229722972%" id="mcps1.3.2.2.2.1.1.5.1.2"><p id="smn_api_56002__p9634155461818"><strong id="smn_api_56002__b593421527191713">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.27202720272027%" id="mcps1.3.2.2.2.1.1.5.1.3"><p id="smn_api_56002__p176342054151820"><strong id="smn_api_56002__b84235270619112">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.78337833783379%" id="mcps1.3.2.2.2.1.1.5.1.4"><p id="smn_api_56002__p8634185410184"><strong id="smn_api_56002__b84235270619115">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_56002__row863485461812"><td class="cellrowborder" valign="top" width="22.972297229722972%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_56002__p15634154191818">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.972297229722972%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_56002__p36341354151815">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.27202720272027%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_56002__p196341954171820">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.78337833783379%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_56002__p11634105415185">Project ID</p>
|
|
<p id="smn_api_56002__p118812918506">See <a href="smn_api_66000.html">Obtaining a Project ID</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_56002__row1563419545185"><td class="cellrowborder" valign="top" width="22.972297229722972%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_56002__p99531421797">resource_type</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.972297229722972%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_56002__p1495310421799">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.27202720272027%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_56002__p149531342296">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.78337833783379%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_56002__p52661238184213">Resource type</p>
|
|
<p id="smn_api_56002__p278251314214">Only <strong id="smn_api_56002__b1330420315416">smn_topic</strong> (topic) is supported.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_56002__row6634254101816"><td class="cellrowborder" valign="top" width="22.972297229722972%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_56002__p1363485413187">resource_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.972297229722972%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_56002__p463417547182">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.27202720272027%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_56002__p7634195417180">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.78337833783379%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_56002__p176341254201810">Resource ID</p>
|
|
<p id="smn_api_56002__p57491711103514">Obtain a resource ID:</p>
|
|
<ul id="smn_api_56002__ul969372310137"><li id="smn_api_56002__li969342316131">Add <strong id="smn_api_56002__b1745003620">X-SMN-RESOURCEID-TYPE=name</strong> in the request header and set the resource ID to the topic name.</li><li id="smn_api_56002__li1669312233134">Call the <strong id="smn_api_56002__b84235270694340">GetResourceInstances</strong> API to obtain the resource ID.</li></ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_56002__section2197105410186"><h4 class="sectiontitle">Request</h4><ul id="smn_api_56002__ul18634105451811"><li id="smn_api_56002__li1634125441812">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_56002__table4213165415189" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_56002__row16634145491814"><th align="left" class="cellrowborder" valign="top" width="16.88%" id="mcps1.3.3.2.1.1.1.5.1.1"><p id="smn_api_56002__p463435412187"><strong id="smn_api_56002__b2035164958">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="24.68%" id="mcps1.3.3.2.1.1.1.5.1.2"><p id="smn_api_56002__p16634054131814"><strong id="smn_api_56002__b1727693177">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.78%" id="mcps1.3.3.2.1.1.1.5.1.3"><p id="smn_api_56002__p9634155414185"><strong id="smn_api_56002__b1885752780">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="37.66%" id="mcps1.3.3.2.1.1.1.5.1.4"><p id="smn_api_56002__p2063413547181"><strong id="smn_api_56002__b1902893602">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_56002__row18634195431818"><td class="cellrowborder" valign="top" width="16.88%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_56002__p156341354131810">tags</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.68%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_56002__p763418543186">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.78%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_56002__p563413548183">Resource_tag structure array</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="37.66%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_56002__p7634654141810">Tag list. For details, see <a href="#smn_api_56002__table1127111434346">Table 1</a>.</p>
|
|
<p id="smn_api_56002__p14459433554">When you delete tags, the tag structure cannot be missing, and the key cannot be left blank or be an empty string. The system does not check the character set when deleting a tag.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_56002__row1263445419182"><td class="cellrowborder" valign="top" width="16.88%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_56002__p16341754191812">action</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.68%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_56002__p363415545188">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.78%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_56002__p176349545181">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="37.66%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_56002__p186342054101815">Operation to be performed, which can be <strong id="smn_api_56002__b842352706101829">create</strong> or <strong id="smn_api_56002__b842352706101833">delete</strong></p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="tablenoborder"><a name="smn_api_56002__table1127111434346"></a><a name="table1127111434346"></a><table cellpadding="4" cellspacing="0" summary="" id="smn_api_56002__table1127111434346" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Resource_tag structure</caption><thead align="left"><tr id="smn_api_56002__smn_api_56001_row139311651171713"><th align="left" class="cellrowborder" valign="top" width="24.672467246724672%" id="mcps1.3.3.2.1.2.2.5.1.1"><p id="smn_api_56002__smn_api_56001_p993135161718"><strong id="smn_api_56002__smn_api_56001_b6377153915111">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.5016501650165%" id="mcps1.3.3.2.1.2.2.5.1.2"><p id="smn_api_56002__smn_api_56001_p13931451141710"><strong id="smn_api_56002__smn_api_56001_b496436261">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.291529152915292%" id="mcps1.3.3.2.1.2.2.5.1.3"><p id="smn_api_56002__smn_api_56001_p393125141712"><strong id="smn_api_56002__smn_api_56001_b36311841175120">Description</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="43.53435343534354%" id="mcps1.3.3.2.1.2.2.5.1.4"><p id="smn_api_56002__smn_api_56001_p1715443212610"><strong id="smn_api_56002__smn_api_56001_b134437429517">Constraint</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_56002__smn_api_56001_row3931105113173"><td class="cellrowborder" valign="top" width="24.672467246724672%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="smn_api_56002__smn_api_56001_p17931145131711">key</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.5016501650165%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="smn_api_56002__smn_api_56001_p16931751111714">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.291529152915292%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="smn_api_56002__smn_api_56001_p393175116171">Tag key</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.53435343534354%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="smn_api_56002__smn_api_56001_p171314419267">A key can contain up to 36 Unicode characters, including only digits, letters, hyphens (-), and underscores (_). A key cannot be left blank, be an empty string, or start or end with a space.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_56002__smn_api_56001_row39312515173"><td class="cellrowborder" valign="top" width="24.672467246724672%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="smn_api_56002__smn_api_56001_p09311651171711">value</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.5016501650165%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="smn_api_56002__smn_api_56001_p14931751141720">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.291529152915292%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="smn_api_56002__smn_api_56001_p159313515179">Tag value</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.53435343534354%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="smn_api_56002__smn_api_56001_p344164632615">A value can contain up to 43 Unicode characters, including only digits, letters, hyphens (-), and underscores (_). A value can be an empty string, but it cannot start or end with a space.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="smn_api_56002__ul14634354201810"><li id="smn_api_56002__li10634254181820">Example request<pre class="screen" id="smn_api_56002__screen0634115471810">POST https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/{resource_id}/tags/action</pre>
|
|
</li></ul>
|
|
<ul id="smn_api_56002__ul1634154191811"><li id="smn_api_56002__li263415471813">Request body<div class="p" id="smn_api_56002__p2877151762820"><a name="smn_api_56002__li263415471813"></a><a name="li263415471813"></a>Request body when <strong id="smn_api_56002__b19982105913459">action</strong> is set to <strong id="smn_api_56002__b13989159194510">create</strong><pre class="screen" id="smn_api_56002__screen4299414122816">{
|
|
"action": "create",
|
|
"tags": [
|
|
{
|
|
"key": "key1",
|
|
"value": "value1"
|
|
},
|
|
{
|
|
"key": "key",
|
|
"value": "value3"
|
|
}
|
|
]
|
|
}</pre>
|
|
</div>
|
|
<p id="smn_api_56002__p15299181414286">Request body when <strong id="smn_api_56002__b249121214615">action</strong> is set to <strong id="smn_api_56002__b2511612104617">delete</strong></p>
|
|
<pre class="screen" id="smn_api_56002__screen16299314172819">{
|
|
"action": "delete",
|
|
"tags": [
|
|
{
|
|
"key": "key1"
|
|
},
|
|
{
|
|
"key": "key2",
|
|
"value": "value3"
|
|
}
|
|
]
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_56002__section112591544183"><h4 class="sectiontitle">Response</h4><p id="smn_api_56002__p0634115441814">None</p>
|
|
</div>
|
|
<div class="section" id="smn_api_56002__section10259185419185"><h4 class="sectiontitle">Returned Value</h4><p id="smn_api_56002__p144041524121813">See <a href="smn_api_63002.html">Returned Value</a>.</p>
|
|
</div>
|
|
<div class="section" id="smn_api_56002__section73211020122511"><h4 class="sectiontitle">Error Codes</h4><p id="smn_api_56002__p9759142919265">See <a href="smn_api_64000.html">Error Codes</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="smn_api_56000.html">Resource Tag Operations</a></div>
|
|
</div>
|
|
</div>
|
|
|