doc-exports/docs/csbs/api-ref/en-us_topic_0098635088.html
Wei, Hongmin 8ce662c4dc CSBS API initial version
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Wei, Hongmin <weihongmin1@huawei.com>
Co-committed-by: Wei, Hongmin <weihongmin1@huawei.com>
2022-10-24 21:06:50 +00:00

211 lines
15 KiB
HTML

<a name="EN-US_TOPIC_0098635088"></a><a name="EN-US_TOPIC_0098635088"></a>
<h1 class="topictitle1">Adding a Tag to a Backup Resource</h1>
<div id="body1519724141385"><div class="section" id="EN-US_TOPIC_0098635088__section53029257"><h4 class="sectiontitle">Function</h4><p class="msonormal" id="EN-US_TOPIC_0098635088__p46350713">A resource can have up to 10 tags.</p>
<p class="msonormal" id="EN-US_TOPIC_0098635088__p14503239">The API is idempotent.</p>
<p class="msonormal" id="EN-US_TOPIC_0098635088__p63420295">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>
</div>
<div class="section" id="EN-US_TOPIC_0098635088__section7501266"><h4 class="sectiontitle">URI</h4><ul id="EN-US_TOPIC_0098635088__ul36770245"><li id="EN-US_TOPIC_0098635088__li62496749">URI format<p id="EN-US_TOPIC_0098635088__p25599835"><a name="EN-US_TOPIC_0098635088__li62496749"></a><a name="li62496749"></a>POST https://{endpoint}/v1/{project_id}/csbs_backup/{resource_id}/tags</p>
</li><li id="EN-US_TOPIC_0098635088__li60320754">Request header
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635088__table6015877" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Request header</caption><thead align="left"><tr id="EN-US_TOPIC_0098635088__row25002739"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.2.2.1.2.5.1.1"><p id="EN-US_TOPIC_0098635088__p209623317216">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16%" id="mcps1.3.2.2.2.1.2.5.1.2"><p id="EN-US_TOPIC_0098635088__p15962193221">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13%" id="mcps1.3.2.2.2.1.2.5.1.3"><p id="EN-US_TOPIC_0098635088__p99783315213">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46%" id="mcps1.3.2.2.2.1.2.5.1.4"><p id="EN-US_TOPIC_0098635088__p6978835213">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635088__row46794527"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635088__p32260306">Content-type</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635088__p154921827359">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635088__p62948031">MIME type of the body in the request</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635088__p14084705">application/json</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635088__row59653487"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635088__p94244">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635088__p2049014274520">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635088__p7633781">User token</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635088__p22030350">-</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<ul id="EN-US_TOPIC_0098635088__ul39627941"><li id="EN-US_TOPIC_0098635088__li21107156">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635088__table55746681" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0098635088__row59842155"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.3.1.1.2.5.1.1"><p id="EN-US_TOPIC_0098635088__p17203192132211">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.2.3.1.1.2.5.1.2"><p id="EN-US_TOPIC_0098635088__p820322192212">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.2.3.1.1.2.5.1.3"><p id="EN-US_TOPIC_0098635088__p220320218227">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46%" id="mcps1.3.2.3.1.1.2.5.1.4"><p id="EN-US_TOPIC_0098635088__p6203121142215">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635088__row55828882"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.3.1.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635088__p25845597">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.3.1.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635088__p13118588">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.3.1.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635088__p55972696">String</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.2.3.1.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635088__p65779720">Project ID</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635088__row51334836"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.3.1.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635088__p64481047">resource_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.3.1.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635088__p55582327">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.3.1.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635088__p5874619">String</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.2.3.1.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635088__p6082124">Resource ID</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0098635088__section402532"><h4 class="sectiontitle">Request</h4><ul id="EN-US_TOPIC_0098635088__ul65556329"><li id="EN-US_TOPIC_0098635088__li53136054">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635088__table8462442" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0098635088__row29754946"><th align="left" class="cellrowborder" valign="top" width="25.252525252525253%" id="mcps1.3.3.2.1.1.2.5.1.1"><p id="EN-US_TOPIC_0098635088__p950072422214">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.141414141414144%" id="mcps1.3.3.2.1.1.2.5.1.2"><p id="EN-US_TOPIC_0098635088__p195001224202211">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.141414141414144%" id="mcps1.3.3.2.1.1.2.5.1.3"><p id="EN-US_TOPIC_0098635088__p850020246221">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.46464646464647%" id="mcps1.3.3.2.1.1.2.5.1.4"><p id="EN-US_TOPIC_0098635088__p2500224152214">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635088__row48033505"><td class="cellrowborder" valign="top" width="25.252525252525253%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635088__p65508730">tag</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635088__p4606919">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635088__p37616177">tag</p>
</td>
<td class="cellrowborder" valign="top" width="46.46464646464647%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635088__p27011487">List of tags</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0098635088__li41776795">Parameter description of field <strong id="EN-US_TOPIC_0098635088__b84235270695528">tag</strong>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635088__table40446842" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Parameter description of field <strong id="EN-US_TOPIC_0098635088__b16407921151918">tag</strong></caption><thead align="left"><tr id="EN-US_TOPIC_0098635088__row62127694"><th align="left" class="cellrowborder" valign="top" width="26%" id="mcps1.3.3.2.2.2.2.5.1.1"><p id="EN-US_TOPIC_0098635088__p11561928102219">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.3.2.2.2.2.5.1.2"><p id="EN-US_TOPIC_0098635088__p13156428142218">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.3.2.2.2.2.5.1.3"><p id="EN-US_TOPIC_0098635088__p41721428172212">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46%" id="mcps1.3.3.2.2.2.2.5.1.4"><p id="EN-US_TOPIC_0098635088__p12172628112218">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635088__row57846236"><td class="cellrowborder" valign="top" width="26%" headers="mcps1.3.3.2.2.2.2.5.1.1 "><p id="EN-US_TOPIC_0098635088__p55033577">key</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.2.2.2.5.1.2 "><p id="EN-US_TOPIC_0098635088__p28534742">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.2.2.2.5.1.3 "><p id="EN-US_TOPIC_0098635088__p29612747">String</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.3.2.2.2.2.5.1.4 "><p id="EN-US_TOPIC_0098635088__p798643483310">Tag key</p>
<p id="EN-US_TOPIC_0098635088__p036816391334">It consists of up to 36 characters.</p>
<p id="EN-US_TOPIC_0098635088__p1815945343312">It cannot be an empty string.</p>
<p id="EN-US_TOPIC_0098635088__p139819543334">Spaces before and after a key will be deprecated.</p>
<p id="EN-US_TOPIC_0098635088__p14766132412516">It can contain only letters, digits, hyphens (-), and underscores (_).</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635088__row45747710"><td class="cellrowborder" valign="top" width="26%" headers="mcps1.3.3.2.2.2.2.5.1.1 "><p id="EN-US_TOPIC_0098635088__p14577007">value</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.2.2.2.5.1.2 "><p id="EN-US_TOPIC_0098635088__p39886950">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.2.2.2.5.1.3 "><p id="EN-US_TOPIC_0098635088__p9617480">String</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.3.2.2.2.2.5.1.4 "><p id="EN-US_TOPIC_0098635088__p11608421163420">Tag value</p>
<p id="EN-US_TOPIC_0098635088__p489413816351">It consists of up to 43 characters.</p>
<p id="EN-US_TOPIC_0098635088__p14194717123517">It can be an empty string.</p>
<p id="EN-US_TOPIC_0098635088__p1146913338362">Spaces before and after a tag value will be deprecated.</p>
<p id="EN-US_TOPIC_0098635088__p12929161920302">It can contain only letters, digits, hyphens (-), and underscores (_).</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0098635088__li31821566">Example request<pre class="screen" id="EN-US_TOPIC_0098635088__screen712635193011">POST https://{endpoint}/v1/{project_id}/csbs_backup/{resource_id}/tags</pre>
</li></ul>
<ul id="EN-US_TOPIC_0098635088__ul45363979"><li id="EN-US_TOPIC_0098635088__li5622632">Example request<pre class="screen" id="EN-US_TOPIC_0098635088__screen1727710103307">{
"tag":
{
"key":"DEV",
"value":"DEV1"
}
}</pre>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0098635088__section3622792"><h4 class="sectiontitle">Status Codes</h4><ul id="EN-US_TOPIC_0098635088__ul5910111"><li id="EN-US_TOPIC_0098635088__li53191007">Normal
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635088__table8957019" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0098635088__row18063398"><th align="left" class="cellrowborder" valign="top" width="42.42%" id="mcps1.3.4.2.1.1.1.3.1.1"><p id="EN-US_TOPIC_0098635088__p53849108">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.58%" id="mcps1.3.4.2.1.1.1.3.1.2"><p id="EN-US_TOPIC_0098635088__p66810458">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635088__row42938017"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.1.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635088__p55427344">204</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.1.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635088__p60429904">No Content</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0098635088__li6998230">Abnormal
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635088__table62984073" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0098635088__row40399134"><th align="left" class="cellrowborder" valign="top" width="42.42%" id="mcps1.3.4.2.2.1.1.3.1.1"><p id="EN-US_TOPIC_0098635088__p51104447">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.58%" id="mcps1.3.4.2.2.1.1.3.1.2"><p id="EN-US_TOPIC_0098635088__p45819581">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635088__row20398591"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635088__p41673198">400</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635088__p20085873">Invalid action.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635088__row46555134"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635088__p12869499">401</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635088__p35796480">Authentication failed.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635088__row53732870"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635088__p57395179">403</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635088__p18497900">You do not have permission to perform this operation.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635088__row32263379"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635088__p63196939">404</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635088__p18678419">The requested resource was not found.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635088__row33888044"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635088__p60577072">500</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635088__p7795800">A system exception occurs.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0098635088__section61541938486"><h4 class="sectiontitle">Error Codes</h4><p id="EN-US_TOPIC_0098635088__p999593594811">For details, see <a href="en-us_topic_0071888297.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0098466174.html">Tag Management</a></div>
</div>
</div>