Use the get operation to perform the following:

  • retrieve SOA record, zone type, zone status of the zone specified by site or site alias ID
  • retrieve SOA record, zone status of the server template

Local DNS server can be enabled or disabled for the specified zone. When it is enabled, it can act as a “primary” or “secondary” name server. If you want to change the type of zone, please refer to the Switching Name Server Mode section.

Request Packet Structure

A request XML packet retrieving a SOA record includes the get operation node:

<packet>
<dns>
   <get>
   ...
   </get>
</dns>
</packet>

The graphical representation of the get node is as follows:

image 34976

Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_input.svg.

  • The filter node is optional. It specifies the filtering rule. For more information, refer to the Available Filters section. Data type: simpleFilterType (dns_input.xsd) .
  • The soa node is required. If specified, the SOA parameters will be returned in the response packet. Data type: none.

 The following table shows the response parameters, if either filter or soa node is omitted.

  SOA present SOA omitted
Filter present SOA record, zone type, zone status of a site or alias zone type, zone status of a site or site alias
Filter omitted zone status, SOA record of the server template  

You can retrieve the parameters of multiple sites or site aliases in a single packet. Add as many get operations as the number of different filtering rules.

<dns>
   <get>
   ...
   </get>
...
   <get>
   ...
   </get>

</dns>

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

Response Packet Structure

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

image 34983

Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_output.svg.

  • The result node is required. It wraps the response from the server. Data type: resultType (common.xsd).
  • The status node is required. It specifies the execution status of the get operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. It is used to return the error code when the get operation fails. Data type: unsignedInt.
  • The errtext node is optional. It is used to return the error message if the set operation fails. Data type: string.
  • The site-id node is optional. It is required if the site ID was set as a filtering rule in the request packet. Data type: integer.
  • The site-alias-id node is optional. It is required if the site alias ID was set as a filtering rule in the request packet. Data type: integer.
  • The soa node is optional. It is required if the soa node was specified in the request packet. Data type: SOAType (plesk_dns.xsd).
  • The zone_type is optional. It is required if the filter node was specified in the request packet. Specifies the type of the DNS name server. Data type: string. Allowed values: master | slave.
  • The zone_status is optional. It is required if the get operation succeeds. Specifies the status of the local DNS name server. Data type: string. Allowed values: enabled | disabled.

Samples

Retrieving the zone type and zone status of a site

This request packet retrieves the zone type and zone status of the site with ID 1.

<packet version="1.6.3.0">
<dns>
 <get>
  <filter>
   <site-id>1</site-id>
  </filter>
 </get>
</dns>
</packet>

Response:

<packet version="1.6.3.0">
<dns>
 <get>
  <result>
   <status>ok</status>
   <site-id>1</site-id>
   <zone_type>master</zone_type>
   <zone_status>enabled</zone_status>
  </result>
 </get>
</dns>
</packet>

Retrieving the SOA record, zone type, and zone status of a site

This request packet retrieves the SOA record, zone type, and zone status of the site with ID 1.

<packet version="1.6.3.0">
<dns>
 <get>
  <filter>
   <site-id>1</site-id>
  </filter>
  <soa/>
 </get>
</dns>
</packet>

Response:

<packet version="1.6.3.0">
<dns>
 <get>
  <result>
   <status>ok</status>
    <site-id>1</site-id>
    <soa>
     <ttl>86400</ttl>
     <refresh>10800</refresh>
     <retry>3600</retry>
     <expire>604800</expire>
     <minimum>10800</minimum>
    </soa>
    <zone_type>master</zone_type>
    <zone_status>enabled</zone_status>
   </result>
  </get>
</dns>
</packet>

Retrieving a zone type, and zone status of a site and a domain alias

This request packet retrieves a zone type, and zone status of the site with ID 2 and domain alias with ID 1.

<packet version="1.6.3.0">
<dns>
 <get>
  <filter>
   <site-alias-id>1</site-alias-id>
  </filter>
 </get>
 <get>
  <filter>
   <site-id>2</site-id>
  </filter>
 </get>
</dns>
</packet>

Request:

<packet version="1.6.3.0">
<dns>
 <get>
  <result>
   <status>ok</status>
   <site-alias-id>1</site-alias-id>
   <zone_type>master</zone_type>
   <zone_status>enabled</zone_status>
  </result>
 </get>

 <get>
  <result>
   <status>ok</status>
   <site-id>2</site-id>
   <zone_type>master</zone_type>
   <zone_status>enabled</zone_status>
  </result>
 </get>
</dns>
</packet>