Retrieving DNS Records

Both zone template records and site or site alias zone records can be retrieved using the get_rec operation. You can retrieve multiple records in a single get_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 retrieving a DNS record from Plesk database includes the get_rec operation node:

<packet>
<dns>
   <get_rec>
   ...
   </get_rec>
</dns>
</packet>

 

The graphical representation of the get_rec node is as follows:

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

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

<dns>
   <get_rec>
   ...
   </get_rec>
...
   <get_rec>
   ...
   </get_rec>

</dns>

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

 
Response Packet Structure

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

 
Samples
Retrieving a single DNS record

This request packet retrieves the DNS record with ID 8.

<packet>
<dns>
 <get_rec>
  <filter>
   <id>8</id>
  </filter>
 </get_rec>
</dns>
</packet>

Response:

<packet>
<dns>
 <get_rec>
  <result>     
   <status>ok</status>
    <id>8</id>
     <data>
    <site-id>8</site-id>
     <type>NS</type>
     <host>Mysite.com.</host>
     <value>ns.Mysite.com.</value>
     <opt></opt>
    </data>
  </result>
 </get_rec>
</dns>
</packet>  

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

<packet>
<dns>
  <get_rec>
  </get_rec>
</dns>
</packet>

 

Retrieving multiple DNS records

This request packet retrieves zone preferences of the site with ID 8.

<packet>
<dns>
 <get_rec>
  <filter>
   <site-id>8</site-id>
  </filter>
 </get_rec>
</dns>
</packet>

Response:

<packet></code>
<dns>
<get_rec>
<result>
   <status>ok</status>
<code>   <id>18</id>
   <data>
    <site-id>8</site-id>
    <type>NS</type>
    <host>Mysite.com</host>
    <value>ns.Mysite.com. </value>
    <opt></opt>
   </data>
  </result>
 <get_rec>
  <result>
   <status>ok</status>
   <id>19</id>
   <data>
    <site-id>8</site-id>
    <type>PTR</type>
    <host></host>
    <value>Mysite.com</value>
    <opt></opt>
   </data>
  </result>
</get_rec>
</dns>
</packet>

If the site with ID 8 was not found on the server, the response from the server looks as follows:

<packet>
<dns>
   <get_rec>
   </get_rec>
</dns>
</packet> 
  <get_rec>
  <result>
   <status>ok</status>
   <id>19</id>
   <data>
    <site-id>8</site-id>
    <type>PTR</type>
    <host></host>
    <value>Mysite.com</value>
    <opt></opt>
   </data>
  </result>
</get_rec>
</dns>
</packet>