Adding DNS Record
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.
- 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.220.127.116.11 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:
The add_rec node is presented by the dnsRecord type (
plesk_dns.xsd). Its graphical representation is as follows:
- 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
- The host node is required. It specifies the IP address or name of a host that will be used by DNS. 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.
Note: In case of SRV record, the opt node can contain additional XML code in the following format:
<Srv Protocol="" Port="" Priority="" Weight=""/>.
Important: 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:
- The result node is required. It wraps the response retrieved from the server. Data type: resultType (
- 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.
Adding a single DNS record
This request packet adds an NS record.
Adding multiple DNS records
This request packet adds A DNS record to DNS zone template and MX record to site with ID 1.