Description

This function creates a DNS zone.

 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
whmapi0 adddns domain=example.com ip=192.168.0.20

{
   "result":[
      {
         "status":1,
         "statusmsg":"Added example.com ok belonging to user1"
      }
   ]
}
<adddns>
     <result>
          <status>1</status>
          <statusmsg>Added example.com ok belonging to user username</statusmsg>
   </result>
</adddns>

   

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.

A valid cPanel or WHM username.

user

 

Returns

ReturnTypeDescriptionPossible valuesExample
resulthashA hash of function status information.This hash contains the status and statusmsg returns. 

status

Boolean

Whether the function succeeded.

The function returns this value in the result hash.

  • 1 — Success.
  • 0 — Failure.
1

statusmsg

string

A message of success or a reason for failure.

The function returns this value in the result hash.

  • Added example.com ok belonging to user
  • An error message.

Added example.com ok belonging to user