Description

This function creates a DNS zone.

 This function also adds an XDNS entry for the domain in the following locations:

  • The /var/cpanel/users/USER file, where USER represents the trueowner parameter's value.
  • The /etc/vdomainaliases/DOMAIN directory, where DOMAIN represents the new zone's domain.
  • The /etc/vfilters/DOMAIN directory, where DOMAIN represents the new zone's domain.

When you call this function, the system uses the domain name and IP address that you supply. WHM's standard zone template determines all other zone information.

This function generates the DNS zone's MX record, domain PTR, and A records automatically.

Examples 


https://hostname.example.com:2087/cpsess##########/json-api/adddns?domain=example.com&ip=192.168.0.20
https://hostname.example.com:2087/cpsess##########/xml-api/adddns?domain=example.com&ip=192.168.0.20
whmapi1 adddns domain=example.com ip=192.168.0.20 

{
  "metadata": {
    "version": 1,
    "reason": "Added example.com ok belonging to user username",
    "result": 1,
    "command": "adddns"
  }
}
<result>
    <metadata>
        <version>1</version>
        <reason>Added example.com ok belonging to user username</reason>
        <result>1</result>
        <command>adddns</command>
    </metadata>
</result>

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The new zone's domain.

A valid domain name on the server.example.com
ipstring

Required

The domain's IP address.

A valid IP address.192.168.0.20
templatestring

The zone file template.

If you do not use this parameter, the function uses the standard zone file template.

  • standard
  • simple
  • standardvirtualftp
  • The name of a custom zone template file in the /var/cpanel/zonetemplates directory.
standard
trueownerstring

The new zone's owner.

This parameter defaults to the currently-logged in cPanel or WHM user's username.

A valid cPanel or WHM username.

user

Returns

This function only returns metadata.