Resource Records define data types in the Domain Name System (DNS). Resource Records identified by RFC 1035 are stored in binary format internally for use by DNS software. But resource records are sent across a network in text format while they perform zone transfers. The following record types are available in Plesk:

  • A (Address). Used for storing an IPv4 32-bit address associated with a domain name.
  • AAAA (IPv6 address) . Used for storing an IPv6 128-bit address associated with a domain name.
  • NS (Authoritative name server). Specifies a host name (which must have an A or an AAAA record associated with it), where DNS information can be found about the site name to which the NS record is attached. NS records are the basic infrastructure on which DNS is built; they stitch together distributed zone files into a directed graph that can be efficiently searched. Defined in RFC 1035.
  • CNAME (Canonical name for a DNS alias). Note that if a site name has a CNAME record associated with it, then it cannot have any other record types. In addition, CNAME records should not point to site names which themselves have associated CNAME records, so CNAME only provides one layer of indirection.
  • MX (Mail Exchanger). Each MX record specifies a site name (which must have an A or an AAAA record associated with it) and a priority; a list of mail exchangers is then ordered by priority when delivering mail. MX records provide one level of indirection in mapping the site part of an email address to a list of host names which are meant to receive mail for that site name. Critical part of the infrastructure used to support SMTP email.
  • PTR (Domain name pointer). Provides a general indirection facility for DNS records. Most often used to provide a way to associate a site name with an IPv4 address in the IN-ADDR.ARPA site.
  • TXT (Text string). Arbitrary binary data, up to 255 bytes in length.
  • DS (Delegation signer). Used for storing certain DNSSEC data of a child domain (namely, hashes of the Key Signing Keys used for signing the domain zone). Presence of this data in the parent zone is necessary for correct work of DNSSEC protection. The DS records that you need to add to the parent zone are available in Plesk UI in DNSSEC settings of a child domain.
  • AXFR (Asynchronous Full Transfer Zone).
  • SRV (service) records are a generalization and expansion of features provided by MX records. Where MX records work only for mail delivery and provide “failover” via the Priority value, SRV records add in support for load balancing (via the Weight value) and port selection (via the Port value). This type of records is available only in Plesk for Windows via XML API v.1.5.0.0 and later.

Note: You can add a DNS record for the specified site or to the DNS zone template. On creation of a new site, Plesk automatically generates zone file for the site or site alias based on the server template.

Request Packet Structure

A request XML packet adding a new DNS record to Plesk database includes the add_rec operation node:

<packet>
<dns>
   <add_rec>
   ...
   </add_rec>
</dns>
</packet>

The add_rec node is presented by the dnsRecord type (plesk_dns.xsd). Its graphical representation is as follows:

image 34809

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 site-id node is optional. If specified, the DNS record will be added to DNS records for the site with the corresponding ID. Data type: integer.
  • The site-alias-id node is optional. If specified, the DNS record will be added to DNS records for the site alias with the corresponding ID. Data type: integer.
  • The type node is required. It specifies the type of the DNS record. For more information about DNS types, refer to the Adding a DNS Record section. Data type: string. Allowed values: A | NS | CNAME | MX | PTR | TXT | SOA | AXFR | SRV | AAAA | DS.
  • The host node is required. It specifies the IP address or name of a host that will be used by DNS, in other words, a prefix for the domain name. You can specify no value in this node to use the domain with ID specified in site-id or site-alias-id. Data type: string.
  • The value node is required. It specifies the value that will be linked with the host value. Data type: string.
  • The opt node is optional. It holds optional information about the DNS record. Data type: string.

Note: If the site-id and site-alias-id parameters are omitted, the DNS record will be added to the DNS zone template.

You can add multiple DNS records using a single packet. Add as many <add-rec> operations as the number of DNS records you want to add.

<dns>
   <add_rec>
   ...
   </add_rec>
...
   <add_rec>
   ...
   </add_rec>

</dns>

Note: In case of SRV record, the opt node can contain additional XML code in the following format: <Srv Protocol="" Port="" Priority="" Weight=""/>.

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

Response Packet Structure

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

image 34819

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 retrieved from the server. Data type: resultType (common.xsd).
  • The status node is required. It specifies the execution status of the add_rec operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. It is used to return the error code when the add_rec operation fails. Data type: unsignedInt.
  • The errtext node is optional. It is used to return the error message if the add_rec operation fails. Data type: string.
  • The id node is optional. It returns the ID of the DNS record; it is required if the add_rec operation has succeeded. Returns the unique identifier of the DNS record just added to Plesk. Data type: integer.

Samples

Adding a single DNS record

This request packet adds an NS record.

<packet>
<dns>
   <add_rec>
      <site-id>1</site-id>
      <type>NS</type>
      <host>Mysite.com</host>
      <value>ns.Mysite.com</value>
   </add_rec>
</dns>
</packet>

This request packet adds a DS record to the zone of the site with ID=1.

<packet>
<dns>
   <add_rec>
      <site-id>1</site-id>
      <type>DS</type>
      <host></host>
      <value>62181 10 2 6CBB33AB0260421C08968A4384AE38778FC88E740B660336A5CF7900 8F3AF9AD</value>
   </add_rec>
</dns>
</packet>

Response:

<packet>
<dns>
<add_rec>
<result>
    <status>ok</status>
    <id>17</id>
</result>
</add_rec>
</dns>
</packet>

Adding multiple DNS records

This request packet adds A DNS record to DNS zone template and MX record to site with ID 1.

<packet>
<dns>
  <add_rec>
      <site-id>1</site-id>
      <type>NS</type>
      <host>Mysite.com</host>
      <value>ns.Mysite.com</value>
    </add_rec>
   <add_rec>
      <type>A</type>
      <host>example.com</host>
      <value>192.0.2.0</value>
   </add_rec>
</dns>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.8.0">
  <dns>
    <add_rec>
      <result>
        <status>ok</status>
        <id>95</id>
      </result>
    </add_rec>
    <add_rec>
      <result>
        <status>ok</status>
        <id>21</id>
      </result>
    </add_rec>
  </dns>
</packet>
</packet>