Deleting DNS Records

Both zone template records and site or site alias zone records can be deleted using the del_rec operation. You can retrieve multiple records in a single del_rec operation using filtering rules. For more information about filters, refer to the Available Filters section.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 
Request Packet Structure

A request XML packet deleting a DNS record from Plesk database includes the get_rec operation node:

<packet>
<dns>
   <del_rec>
   ...
   </del_rec>
</dns>
</packet>

 

The graphical representation of the del_rec node is as follows:

Note: If you leave the filter node blank (<filter/>) all records (zone template records or zone records, depending on presence of the template node in the request packet) will be removed.

You can delete multiple DNS records in a single packet. Add as many del_rec operations as the number of different filtering rules.

<dns>
   <del_rec>
   ...
   </del_rec>
...
   <del_rec>
   ...
   </del_rec>

</dns>

Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.

 
Response Packet Structure

The del_rec node of the output XML packet is structured as follows:

 

 
Samples
Deleting a single DNS record

This request packet deletes DNS record with ID 75.

<packet>
<dns>
   <del_rec>
      <filter>
            <id>75</id>
      </filter>
   </del_rec>
</dns>
</packet>

Reponse:

<packet>
<dns>
   <del_rec>
   <result>
      <status>ok</status>
      <id>75</id>
   </result>
   </del_rec>
</dns>
</packet>

 

If the DNS record with ID 75 was not found on the server, the response from the server looks as follows:

<packet>
<dns>
<del_rec>

<result>
   <status>error</status>
   <errcode>1013</errcode>
   <errtext>DNS record does not exist.</errtext>
   <id>75</id>
</result>

</del_rec>
</dns>
</packet> 
Deleting multiple DNS records

This request packet deletes DNS records for the site ID 7 and the record with ID 5.

<packet>
<dns>
   <del_rec>
      <filter>
            <site-id>7</site-id>
      </filter>
   </del_rec>
   <del_rec>
      <filter>
            <id>5</id>
      </filter>
   </del_rec>
</dns>
</packet>

 

Response (when three DNS records for the site alias were deleted, and the record with ID 5 was not found on the server):

<packet>
<dns>
  <del_rec>
      <result>
            <status>ok</status>
            <id>17</id>
      </result>
      <result>
            <status>ok</status>
            <id>18</id>
      </result>
      <result>
            <status>ok</status>
            <id>19</id>
      </result>
   </del_rec>
   <del_rec/>
</dns>
</packet>