Child pages
  • WHM API 1 Functions - adddns

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

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.

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledDNSRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleJSON API


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



Expand
titleXML API


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



Expand
titleCommand Line


Code Block
languagebash
whmapi1 adddns domain=example.com ip=192.168.0.20 

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
  "metadata": {
    "version": 1,
    "reason": "Added example.com ok belonging to user username",
    "result": 1,
    "command": "adddns"
  }
}



Expand
titleOutput (XML)


Code Block
languagetext
linenumberstrue
<result>
    <metadata>
        <version>1</version>
        <reason>Added example.com ok belonging to user username</reason>
        <result>1</result>
        <command>adddns</command>
    </metadata>
</result>


Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote


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.