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:

  • The filter node is required. It specifies the filtering rule. For more information, refer to the Available Filters section. Data type: dnsSelectionFilterType(dns_input.xsd).
  • The template node is optional. If present, only DNS zone template records are available for deleting. In this case filter children cannot be specified as a filtering rule. Data type: none.

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:

  • The result node is optional. It is required if the operation del_rec succeeds and the data set retrieved from the server is not empty. If the id was set as a filtering rule in the request packet, the result node is also required. Data type: resultType (common.xsd).
  • The status node is required. It specifies the execution status of the del_rec operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. It is used to return the error code when the del_rec operation fails. Data type: unsignedInt.
  • The errtext node is optional. It is used to return the error message if the del_rec operation fails. Data type: string.
  • The id node is required if the del_rec operation has succeeded. If the id was set as a filtering rule in the request packet, the id node is also required. Returns the unique identifier of the DNS record. Data type: integer.

 

 
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>

 

 

Leave your comments on this page

Leave your feedback or question on this documentation topic below. For technical assistance, contact your hosting service provider or submit a request to Plesk support. Suggest new features for Plesk here. Discuss general questions on the Plesk forum. All offtopic comments will be removed.