Files
doc-exports/docs/ecs/api-ref/en-us_topic_0020212679.html
wanghuijuan738 8f024b87ae ECS API 20251204 version. Adding an API Document.
Reviewed-by: Pristromskaia, Margarita <margarita.pristromskaia@t-systems.com>
Co-authored-by: wanghuijuan738 <wanghuijuan738@huawei.com>
Co-committed-by: wanghuijuan738 <wanghuijuan738@huawei.com>
2025-12-17 11:05:14 +00:00

202 lines
19 KiB
HTML

<a name="EN-US_TOPIC_0020212679"></a><a name="EN-US_TOPIC_0020212679"></a>
<h1 class="topictitle1">Deleting <span id="text099555552211">ECS</span>s</h1>
<div id="body59650110"><div class="section" id="EN-US_TOPIC_0020212679__section61511739"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0020212679__p7120111454714">This API is used to delete <span id="EN-US_TOPIC_0020212679__text129391856162216">ECS</span>s based on a specified <span id="EN-US_TOPIC_0020212679__text15110029153011">ECS</span> ID list.</p>
<p id="EN-US_TOPIC_0020212679__p18734754175018">This API is an asynchronous API. After the deletion request is successfully delivered, a job ID is returned. This does not mean the deletion is complete. You need to call the API by referring to <a href="en-us_topic_0022225398.html">Querying Job Execution Status</a> to query the job status. The SUCCESS status indicates that the deletion is successful.</p>
<p id="EN-US_TOPIC_0020212679__p66929645">You can delete a single <span id="EN-US_TOPIC_0020212679__text1020335811226">ECS</span> or multiple <span id="EN-US_TOPIC_0020212679__text19842144618300">ECS</span>s in a batch. A maximum of 1,000 <span id="EN-US_TOPIC_0020212679__text164866518309">ECS</span>s can be deleted in a batch.</p>
</div>
<div class="section" id="EN-US_TOPIC_0020212679__section16734741"><h4 class="sectiontitle">URI</h4><p id="EN-US_TOPIC_0020212679__p50237013152238">POST /v1/{project_id}/cloudservers/delete</p>
<div class="p" id="EN-US_TOPIC_0020212679__p182688151487"><a href="#EN-US_TOPIC_0020212679__table52652517">Table 1</a> describes the parameters in the URI.
<div class="tablenoborder"><a name="EN-US_TOPIC_0020212679__table52652517"></a><a name="table52652517"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0020212679__table52652517" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0020212679__row61945077"><th align="left" class="cellrowborder" valign="top" width="16.42%" id="mcps1.3.2.3.2.2.4.1.1"><p id="EN-US_TOPIC_0020212679__p51495331">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.36%" id="mcps1.3.2.3.2.2.4.1.2"><p id="EN-US_TOPIC_0020212679__p10372286">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="66.22%" id="mcps1.3.2.3.2.2.4.1.3"><p id="EN-US_TOPIC_0020212679__p34848813">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0020212679__row4181593"><td class="cellrowborder" valign="top" width="16.42%" headers="mcps1.3.2.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0020212679__p3164713">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.36%" headers="mcps1.3.2.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0020212679__p55015173">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="66.22%" headers="mcps1.3.2.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0020212679__p37593705">Specifies the project ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0020212679__section16394943"><h4 class="sectiontitle">Request</h4><div class="p" id="EN-US_TOPIC_0020212679__p495714358498"><a href="#EN-US_TOPIC_0020212679__table8361976">Table 2</a> describes the request parameters.
<div class="tablenoborder"><a name="EN-US_TOPIC_0020212679__table8361976"></a><a name="table8361976"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0020212679__table8361976" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0020212679__row2187155"><th align="left" class="cellrowborder" valign="top" width="16.348365163483656%" id="mcps1.3.3.2.2.2.5.1.1"><p id="EN-US_TOPIC_0020212679__p42941906">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.548245175482453%" id="mcps1.3.3.2.2.2.5.1.2"><p id="EN-US_TOPIC_0020212679__p55742394">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.748525147485253%" id="mcps1.3.3.2.2.2.5.1.3"><p id="EN-US_TOPIC_0020212679__p18840050">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="51.35486451354865%" id="mcps1.3.3.2.2.2.5.1.4"><p id="EN-US_TOPIC_0020212679__p49649058">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0020212679__row62150771"><td class="cellrowborder" valign="top" width="16.348365163483656%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="EN-US_TOPIC_0020212679__p1047692">servers</p>
</td>
<td class="cellrowborder" valign="top" width="17.548245175482453%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="EN-US_TOPIC_0020212679__p17754262">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.748525147485253%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="EN-US_TOPIC_0020212679__p28809145">Array of objects</p>
</td>
<td class="cellrowborder" valign="top" width="51.35486451354865%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="EN-US_TOPIC_0020212679__p1238965319"><strong id="EN-US_TOPIC_0020212679__b81767715042246">Definition</strong></p>
<p id="EN-US_TOPIC_0020212679__p63901309">Specifies the <span id="EN-US_TOPIC_0020212679__text172112232318">ECS</span>s to be deleted. For details, see <a href="#EN-US_TOPIC_0020212679__table32603030">Table 3</a>.</p>
<p id="EN-US_TOPIC_0020212679__p1524183711019"><strong id="EN-US_TOPIC_0020212679__b115617872943515">Constraints</strong></p>
<p id="EN-US_TOPIC_0020212679__p174932058131211">A maximum of 1,000 <span id="EN-US_TOPIC_0020212679__text19412070133">ECS</span>s can be deleted at a time.</p>
<p id="EN-US_TOPIC_0020212679__p1014063918912"><strong id="EN-US_TOPIC_0020212679__b1254084664303">Range</strong></p>
<p id="EN-US_TOPIC_0020212679__p115873267109">N/A</p>
<p id="EN-US_TOPIC_0020212679__p1770453318100"><strong id="EN-US_TOPIC_0020212679__b126814124644234">Default Value</strong></p>
<p id="EN-US_TOPIC_0020212679__p12966135415105">N/A</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0020212679__row2098702122911"><td class="cellrowborder" valign="top" width="16.348365163483656%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="EN-US_TOPIC_0020212679__p91331882916">delete_publicip</p>
</td>
<td class="cellrowborder" valign="top" width="17.548245175482453%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="EN-US_TOPIC_0020212679__p59877214295">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.748525147485253%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="EN-US_TOPIC_0020212679__p7987192102915">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="51.35486451354865%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="EN-US_TOPIC_0020212679__p2024952613411"><strong id="EN-US_TOPIC_0020212679__b109175388642246">Definition</strong></p>
<p id="EN-US_TOPIC_0020212679__p592249548">Specifies whether to delete the EIP bound to the ECS when deleting the ECS. If you do not want to delete the EIP, the system only unbinds the EIP from the ECS and reserves the EIP.</p>
<p id="EN-US_TOPIC_0020212679__p1559918483135"><strong id="EN-US_TOPIC_0020212679__b115298524743515">Constraints</strong></p>
<p id="EN-US_TOPIC_0020212679__p6415963513">If <strong id="EN-US_TOPIC_0020212679__b991192311615">delete_publicip</strong> is not specified, the <strong id="EN-US_TOPIC_0020212679__b16911162319164">delete_on_termination</strong> value of the <span id="EN-US_TOPIC_0020212679__text6415166512">EIP</span> decides whether the EIP is released when the ECS is deleted.</p>
<ul id="EN-US_TOPIC_0020212679__ul541514616516"><li id="EN-US_TOPIC_0020212679__li1341536553">If <strong id="EN-US_TOPIC_0020212679__b37562430716">delete_on_termination</strong> is <strong id="EN-US_TOPIC_0020212679__b1436194718719">true</strong> and <strong id="EN-US_TOPIC_0020212679__b36215506718">delete_public</strong> is <strong id="EN-US_TOPIC_0020212679__b23345522078">null,</strong> the <span id="EN-US_TOPIC_0020212679__text1541517616511">EIP</span> is released when the ECS is deleted.</li><li id="EN-US_TOPIC_0020212679__li841586253">If <strong id="EN-US_TOPIC_0020212679__b15691238161819">delete_on_termination</strong> is <strong id="EN-US_TOPIC_0020212679__b16917389187">false</strong> and <strong id="EN-US_TOPIC_0020212679__b17691163881817">delete_public</strong> is <strong id="EN-US_TOPIC_0020212679__b13691113891813">null</strong>, the <span id="EN-US_TOPIC_0020212679__text144151462519">EIP</span> is only unbound from the ECS and will not be released when the ECS is deleted.</li></ul>
<p id="EN-US_TOPIC_0020212679__p671192161413"><strong id="EN-US_TOPIC_0020212679__b17387188104303">Range</strong></p>
<ul id="EN-US_TOPIC_0020212679__ul49220485417"><li id="EN-US_TOPIC_0020212679__li199214416544"><strong id="EN-US_TOPIC_0020212679__b189235610516">true</strong>: When an ECS is deleted, the EIP bound to the ECS is also released regardless of whether <strong id="EN-US_TOPIC_0020212679__b1867017121767">delete_on_termination</strong> of the EIP is <strong id="EN-US_TOPIC_0020212679__b12424615461">true</strong> or <strong id="EN-US_TOPIC_0020212679__b557174614">false</strong>.</li><li id="EN-US_TOPIC_0020212679__li199217415415"><strong id="EN-US_TOPIC_0020212679__b730017910495">false</strong>: When an ECS is deleted, the EIP is only unbound from the ECS and will not be released regardless of whether <strong id="EN-US_TOPIC_0020212679__b168904355591">delete_on_termination</strong> of the EIP is <strong id="EN-US_TOPIC_0020212679__b46345492590">true</strong> or <strong id="EN-US_TOPIC_0020212679__b9634124914598">false</strong>.</li></ul>
<p id="EN-US_TOPIC_0020212679__p144192411413"><strong id="EN-US_TOPIC_0020212679__b87289402144234">Default Value</strong></p>
<p id="EN-US_TOPIC_0020212679__p157131326143">false</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0020212679__row812619181914"><td class="cellrowborder" valign="top" width="16.348365163483656%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="EN-US_TOPIC_0020212679__p5796201231911">delete_volume</p>
</td>
<td class="cellrowborder" valign="top" width="17.548245175482453%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="EN-US_TOPIC_0020212679__p1679661217194">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.748525147485253%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="EN-US_TOPIC_0020212679__p8796101219193">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="51.35486451354865%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="EN-US_TOPIC_0020212679__p1477711281758"><strong id="EN-US_TOPIC_0020212679__b1215912481910">Definition</strong></p>
<p id="EN-US_TOPIC_0020212679__p169818388196">Specifies whether to delete the data disks attached to an <span id="EN-US_TOPIC_0020212679__text19810174545717">ECS</span> when deleting the <span id="EN-US_TOPIC_0020212679__text187695724616">ECS</span>. If you set the parameter value to <strong id="EN-US_TOPIC_0020212679__b188501459104816">false</strong>, the system only detaches the disks from the <span id="EN-US_TOPIC_0020212679__text158111345135715">ECS</span> and reserves the disks.</p>
<p id="EN-US_TOPIC_0020212679__p679163115153"><strong id="EN-US_TOPIC_0020212679__b154971972543515">Constraints</strong></p>
<p id="EN-US_TOPIC_0020212679__p15443545151512">N/A</p>
<p id="EN-US_TOPIC_0020212679__p12874149171510"><strong id="EN-US_TOPIC_0020212679__b5736528544303">Range</strong></p>
<ul id="EN-US_TOPIC_0020212679__ul10698103831919"><li id="EN-US_TOPIC_0020212679__li3698183851913"><strong id="EN-US_TOPIC_0020212679__b1940512183185">true</strong>: indicates to delete the data disks attached to the <span id="EN-US_TOPIC_0020212679__text194108185186">ECS</span> when deleting the <span id="EN-US_TOPIC_0020212679__text9410161871816">ECS</span>.</li><li id="EN-US_TOPIC_0020212679__li1869811386190"><strong id="EN-US_TOPIC_0020212679__b106271223101810">false</strong>: indicates only to detach the data disks attached to the <span id="EN-US_TOPIC_0020212679__text7632723171814">ECS</span> when deleting the <span id="EN-US_TOPIC_0020212679__text2632923101817">ECS</span>.</li></ul>
<p id="EN-US_TOPIC_0020212679__p206742011167"><strong id="EN-US_TOPIC_0020212679__b145125058144234">Default Value</strong></p>
<p id="EN-US_TOPIC_0020212679__p15106121151614">false</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0020212679__table32603030"></a><a name="table32603030"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0020212679__table32603030" frame="border" border="1" rules="all"><caption><b>Table 3 </b><strong id="EN-US_TOPIC_0020212679__b113541542151614">servers</strong> field description</caption><thead align="left"><tr id="EN-US_TOPIC_0020212679__row25141347"><th align="left" class="cellrowborder" valign="top" width="16.35%" id="mcps1.3.3.2.3.2.5.1.1"><p id="EN-US_TOPIC_0020212679__p3065418507">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.48%" id="mcps1.3.3.2.3.2.5.1.2"><p id="EN-US_TOPIC_0020212679__p100135425018">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.85%" id="mcps1.3.3.2.3.2.5.1.3"><p id="EN-US_TOPIC_0020212679__p170854105015">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="51.32%" id="mcps1.3.3.2.3.2.5.1.4"><p id="EN-US_TOPIC_0020212679__p816115445017">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0020212679__row53999455"><td class="cellrowborder" valign="top" width="16.35%" headers="mcps1.3.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0020212679__p11879716">id</p>
</td>
<td class="cellrowborder" valign="top" width="17.48%" headers="mcps1.3.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0020212679__p22732954">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.85%" headers="mcps1.3.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0020212679__p29429992">String</p>
</td>
<td class="cellrowborder" valign="top" width="51.32%" headers="mcps1.3.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0020212679__p986014425620"><strong id="EN-US_TOPIC_0020212679__b1060092392018">Definition</strong></p>
<p id="EN-US_TOPIC_0020212679__p35019191">Specifies the ID of the <span id="EN-US_TOPIC_0020212679__text8316191222318">ECS</span> to be deleted.</p>
<p id="EN-US_TOPIC_0020212679__p10931172901610"><strong id="EN-US_TOPIC_0020212679__b206994024243515">Constraints</strong></p>
<p id="EN-US_TOPIC_0020212679__p17460113661618">N/A</p>
<p id="EN-US_TOPIC_0020212679__p18675344151617"><strong id="EN-US_TOPIC_0020212679__b21124687624303">Range</strong></p>
<p id="EN-US_TOPIC_0020212679__p451145020166">N/A</p>
<p id="EN-US_TOPIC_0020212679__p4860200111716"><strong id="EN-US_TOPIC_0020212679__b11097684444234">Default Value</strong></p>
<p id="EN-US_TOPIC_0020212679__p2084919107178">N/A</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0020212679__section112357236514"><h4 class="sectiontitle">Response</h4><p id="EN-US_TOPIC_0020212679__p583313195412"><a href="#EN-US_TOPIC_0020212679__table2824153181913">Table 4</a> describes the response parameters.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0020212679__table2824153181913"></a><a name="table2824153181913"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0020212679__table2824153181913" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Response parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0020212679__row11825193111915"><th align="left" class="cellrowborder" valign="top" width="16.85%" id="mcps1.3.4.3.2.4.1.1"><p id="EN-US_TOPIC_0020212679__p135632102272">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.98%" id="mcps1.3.4.3.2.4.1.2"><p id="EN-US_TOPIC_0020212679__p55632010102714">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="65.16999999999999%" id="mcps1.3.4.3.2.4.1.3"><p id="EN-US_TOPIC_0020212679__p125631410152717">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0020212679__row382615381910"><td class="cellrowborder" valign="top" width="16.85%" headers="mcps1.3.4.3.2.4.1.1 "><p id="EN-US_TOPIC_0020212679__p1882713151914">job_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.98%" headers="mcps1.3.4.3.2.4.1.2 "><p id="EN-US_TOPIC_0020212679__p1182723161913">String</p>
</td>
<td class="cellrowborder" valign="top" width="65.16999999999999%" headers="mcps1.3.4.3.2.4.1.3 "><p id="EN-US_TOPIC_0020212679__p79774531157"><strong id="EN-US_TOPIC_0020212679__b2038521506">Definition</strong></p>
<p id="EN-US_TOPIC_0020212679__p12827133121914">Specifies the job ID returned after a job is delivered. The job ID can be used to query the job execution progress. For details about how to query the job execution status based on <strong id="EN-US_TOPIC_0020212679__b184352639023552">job_id</strong>, see <a href="en-us_topic_0022225397.html">Job Status Management</a>.</p>
<p id="EN-US_TOPIC_0020212679__p10609556134619"><strong id="EN-US_TOPIC_0020212679__b1627032703">Range</strong></p>
<p id="EN-US_TOPIC_0020212679__p8453833853">N/A</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0020212679__p827131024410">For details about abnormal responses, see <a href="en-us_topic_0022067714.html">Responses (Jobs)</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0020212679__section159261353165117"><h4 class="sectiontitle">Example Request</h4><ul id="EN-US_TOPIC_0020212679__ul13679403146"><li id="EN-US_TOPIC_0020212679__li46784021417">Delete the ECS whose ID is <strong id="EN-US_TOPIC_0020212679__b138664917162">616fb98f-46ca-475e-917e-2563e5a8cd19</strong>, unbind the EIP, and detach data disks.<pre class="screen" id="EN-US_TOPIC_0020212679__screen526562355119">POST https://{endpoint}/v1/{project_id}/cloudservers/delete
{
"servers": [
{
"id": "616fb98f-46ca-475e-917e-2563e5a8cd19"
}
],
"delete_publicip": false,
"delete_volume": false
}</pre>
</li><li id="EN-US_TOPIC_0020212679__li191849422145">Delete <span id="EN-US_TOPIC_0020212679__text48331252133">ECS</span>s whose IDs are<strong id="EN-US_TOPIC_0020212679__b09701351132917"> 616fb98f-46ca-475e-917e-2563e5a8cd19</strong>, <strong id="EN-US_TOPIC_0020212679__b11295195502916">616fb98f-46ca-475e-917e-2563e5a8ef20</strong>, and <strong id="EN-US_TOPIC_0020212679__b19191457132917">616fb98f-46ca-475e-917e-2563e5a8gh21</strong> in batches.<pre class="screen" id="EN-US_TOPIC_0020212679__screen108331625121314">POST https://{endpoint}/v1/{project_id}/cloudservers/delete
{
"delete_publicip": false,
"delete_volume": false,
"servers": [
{
"id": "616fb98f-46ca-475e-917e-2563e5a8cd19"
},
{
"id": "616fb98f-46ca-475e-917e-2563e5a8ef20"
},
{
"id": "616fb98f-46ca-475e-917e-2563e5a8gh21"
}
]
}</pre>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0020212679__section5373174623216"><h4 class="sectiontitle">Example Response</h4><pre class="screen" id="EN-US_TOPIC_0020212679__screen24271946143218">{
"job_id": "ff80808288d415d80189901d8eb81cbb"
}</pre>
<p id="EN-US_TOPIC_0020212679__p15427946203217">Or</p>
<pre class="screen" id="EN-US_TOPIC_0020212679__screen042719461325">{
"error": {
"message": "request body is illegal.",
"code": "Ecs.0005"
}
}</pre>
</div>
<div class="section" id="EN-US_TOPIC_0020212679__section12571834"><h4 class="sectiontitle">Returned Values</h4><p id="EN-US_TOPIC_0020212679__p1627121972213">See <a href="en-us_topic_0022067716.html">Returned Values for General Requests</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0020212679__section85821649202813"><h4 class="sectiontitle">Error Codes</h4><p id="EN-US_TOPIC_0020212679__p7233105282813">See <a href="en-us_topic_0022067717.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0020212657.html">Lifecycle Management</a></div>
</div>
</div>