Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function edits a DNS zone record. To effectively use this function, use the following workflow:

  1. Run the dumpzone function on the DNS zone record to edit.
  2. Locate the Line value that corresponds to the data to edit.
  3. Use the values from that zone record to formulate the appropriate editzonerecord parameters.

Important:

  • When you call this function, you must include the additional parameters for the selected zone record type. 
  • To change the zone record's IP address, we recommend that you use the swapip utility or the setsiteip function instead.
  • You cannot edit other DNS zones that reside on Write-only servers in a DNS cluster.

Note:

On servers that run CentOS 7, you may see a named warning about the absence of SPF resource records on DNS.

  • This warning is not relevant on CentOS 7 servers, because RFC 7208 deprecated SPF records. CentOS 7 servers use TXT records instead of SPF records.
  • Red Hat 7.1 and CentOS 7.1 both contain bind-9.9.4-23.el7, which is an updated version of BIND that complies with RFC 7208. To resolve this issue, update your operating system to a version that contains the updated version of BIND. For more information, read the the Red Hat Bugzilla case about SPF record errors.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/editzonerecord?api.version=1&domain=example.com&line=24&name=hostname.example.com.&class=IN&ttl=86400&type=A&address=192.168.0.20
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/editzonerecord?api.version=1&domain=example.com&line=24&name=hostname.example.com.&class=IN&ttl=86400&type=A&address=192.168.0.20
 Command Line
whmapi1 editzonerecord domain=example.com line=24 name=hostname.example.com. class=IN ttl=86400 type=A address=192.168.0.20

Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
  "metadata": {
    "version": 1,
    "reason": "Bind reloading on hostname using rndc zone: [example.com]\n",
    "result": 1,
    "command": "editzonerecord"
  }
}
 Output (XML)
<result>
    <metadata>
        <version>1</version>
        <reason>
            Bind reloading on hostname using rndc zone: [example.com]
        </reason>
        <result>1</result>
        <command>editzonerecord</command>
    </metadata>
</result>

Note:

Use WHM's API Shell interface (Home >> Development >> API Shell) to directly test WHM API calls.

   

Parameters

ParameterTypeDescriptionPossible valuesExample

domain

string

Required

The zone record's domain.

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

Required

The zone record's file line number.

A positive integer that represents a line number in the domain's DNS zone file.24
namestring

Required

The record's name.

A valid domain name or hostname.

Note:

Do not omit any necessary trailing periods. 

hostname.example.com.
classstring

Required

The record's class.

  • IN
  • Very rarely, another valid DNS record class.

IN
ttlinteger

Required

The record's Time To Live (TTL).

A positive integer that represents the TTL, in seconds.

86400
typestring

Required

The DNS record type.

Warning:

The DNS record type determines the additional DNS zone record parameters that you must include.

  • AA records store IPv4 addresses. Use them to map a hostname to an IPv4 address.
  • A6A6 records store IPv6 addresses.

    Note:

    A6 records are deprecated . We strongly recommend that you use AAAA records to store IPv6 addresses.  

  • AAAAAAAA records store IPv6 addresses.
  • ASFDBASFDB records store the location of an AFS cell's database servers.
  • CNAMECNAME records create an alias to another hostname.
  • DNAMEDNAME records create an alias for a hostname and its subnames.
  • DSDS records specify a record's delegation signer.
  • HINFOHINFO records specify a host's CPU and OS types.
  • LOCLOC records store a hostname's geographical location.
  • MXMX records point a domain name to its MTAs.
  • NSNS records store a domain's authoritative nameservers.
  • PTRPTR records point to a CNAME.
  • RPRP records store a domain's Responsible Person's information.
  • SOASOA records designate the beginning of a zone of authority.
  • SRVSRV records store the service location records for newer protocols (for example, Autodiscover).
  • SSHFPSSHFP records store a domain's SSH public host key's fingerprint.

    Warning:

    We do not currently support this DNS record type. 

  • TXTTXT records store descriptive text or useful records (for example, SPF or DKIM records).
A

A Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
addressstringThe zone record's IPv4 address.A valid IPv4 address.192.168.0.20

Note:

For more information about A records, read RFC 1035 at IANA.

 A6 Record Parameters

 Click to view...

Important:

A6 records are deprecated. We strongly recommend that you use AAAA records to store IPv6 addresses. 

ParameterTypeDescriptionPossible valuesExample
prefixstringThe record's prefix length.A positive integer.48
referstringThe record's address suffix.

A valid IPv6 address suffix.

Note

You must uuencode the colons (:) in IPv6 addresses in your function calls.
0::0

 AAAA Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
addressstringThe zone record's IPv6 address.

A valid IPv6 address.

Note

You must uuencode the colons (:) in IPv6 addresses in your function calls.
2001:1:42:1::2a

Note:

For more information about AAAA records, read RFC 3596 at IANA .

 AFSDB Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
subtypeintegerThe AFS cell type.

A 16-bit integer that represents the type of AFS cell.

For example, specify 1 to signify an AFS version 3.0 Volume Location Server.

1
hostnamestringThe database servers' hostname.A valid hostname.afs.example.com

Note:

For more information about ASFDB records, read RFC 1183 at IANA.

 CNAME Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
cnamestringThe canonical name (CNAME) alias.A valid alias.sydneybristow.example.com
flattenBoolean

Whether to resolve the specified CNAME value with the record's IP address.

If you do not also set the flatten_to parameter, the system will attempt to resolve the CNAME automatically.

Note:

Only use this parameter when you alter the zone's root record.


  • 1 — Flattened.
  • 0 — Not flattened (the function will fail).
1
flatten_tostring

The IP address that the specified CNAME will resolve to.

You must use the flatten parameter with this parameter.

A valid IPv4 or IPv6 address.192.168.0.20

Note:

For more information about CNAME records, read RFC 1035 at IANA .

 DNAME Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
dnamestringThe delegation name (DNAME) alias.A valid alias.hostname.dev.example.com

Note:

For more information about DNAME records, read RFC 2672 at IANA.

 DS Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
keynameintegerThe record's KeyTag value.

An unsigned decimal integer.

2642
algorithmintegerThe record's algorithm number.
  • 1 — RSAMD5
  • 2 — Diffie-Hellman
  • 3 — DSA/SHA-1
  • 4 — Elliptic Curve
  • 5 — RSA/SHA-1
  • 252 — Indirect
  • 253 — Private DNS
  • 254 — Private OID
5
digitypeintegerThe record's digest type.
  • 1 — SHA-1
1

Note:

For more information about DS records, read RFC 4034 at IANA.

 HINFO Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
cpustringThe host's CPU type.

A valid CPU type.

INTEL-386
osstringThe host's operating system.

A valid operating system.

UNIX

Note:

For more information about HINFO records, read RFC 1700 at IANA.

 LOC Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
versionintegerThe record's version number.

You must set this value to 0.

0
sizeintegerThe diameter of a sphere that encloses the entire location.

A positive integer that represents a diameter, in meters.

10
horiz_preintegerThe location's horizontal precision.A positive integer that represents a distance, in meters.10
vert_preintegerThe location's vertical precision.A positive integer that represents a distance, in meters.10
latitudestringThe location's latitude.A valid latitude.41 51 54.305 N
longitudestringThe location's longitude.A valid longitude.87 36 47.95 W
altitudestringThe location's altitude.

The location's altitude above sea level, in meters.

Note:

Make certain that you append m to the altitude value. 

178m

Note:

For more information about LOC records, read RFC 1876 at IANA .

 MX Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
preferenceintegerThe record's preference.

An integer that represents the record's priority order.

Note:

Lower values have a higher priority order. 

10
exchangestringThe server's location's canonical name (CNAME).

A valid CNAME.

mail.example.com

Note:

For more information about MX records, read RFC 1035 at IANA.

 NS Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
nsdnamestringThe domain's authoritative nameserver.

A valid nameserver.

ns1.example.com

Note:

For more information about NS records, read RFC 1035 at IANA.

 PTR Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
ptrdnamestringA pointer to a canonical name (CNAME).

A valid hostname.

Note:

Do not omit any necessary trailing periods. 

hostname.example.com.

Note:

For more information about PTR records, read RFC 1035 at IANA.

 RP Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
mboxstringThe Responsible Person's (RP's) email address.

A valid email address.

Note:

  • Replace the @ symbol with a period (.).
  • Do not omit any necessary trailing periods.
user.example.com.
txtdnamestringThe RP's domain name.

A valid hostname.

Note:

Do not omit any necessary trailing periods. 

mx1.host.example.com.

Note:

For more information about RP records, read RFC 1183 at IANA.

 SOA Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
serialintegerThe zone file's revision number.

A valid revision number.

2013122501
mnamestringThe domain's authoritative nameserver.

A valid nameserver.

ns1.example.com
retryintegerThe amount of time to wait before the secondary server retries a failed zone transfer.A positive integer that represents an amount of time, in seconds.1440
refreshstringThe amount of time to wait before the secondary DNS server queries the primary DNS server's SOA records for changes.A positive integer that represents an amount of time, in seconds.1440
LinesstringThe number of lines in the SOA section.A positive integer that represents a number of lines.4
expirestringThe amount of time to wait before the secondary server attempts to complete a zone transfer.A positive integer that represents an amount of time, in seconds.3600000
rnamestringThe Responsible Person's (RP's) email address.

A valid email address.

Note:

  • Replace the @ symbol with a period (.).
  • Do not omit any necessary trailing periods.
user.example.com.

Note:

For more information about SOA records, read RFC 1035 at IANA.

 SRV Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
priorityintegerThe target host's preference.

An integer that represents the target host's priority order.

Note:

Lower numbers have a higher priority order. 

0
weightintegerA relative weight. The system uses this value to rank entries with the same priority value.

An integer that represents the target host's weight against other hosts with the same priority value.

2
portintegerThe target host's port.A valid port number.389
targetstringThe service's target host.A valid hostname.service.example.com

Note:

For more information about SRV records, read RFC 2782 at IANA.

 SSHFP Record Parameters

 Click to view...

Warning:

We do not currently support this DNS record type. 

ParameterTypeDescriptionPossible valuesExample
algorithmstringThe public key's algorithm number.
  • 1 — RSA
  • 2 — DSS
1
fptypestringThe public key's fingerprint type.
  • 1 — SHA-1

 

1

Note:

For more information about SSHFP records, read RFC 4255 at IANA.

 TXT Record Parameters

 Click to view...
ParameterTypeDescriptionPossible valuesExample
txtdatastringThe TXT record's data.

A valid TXT record.

Note:

Surround this string with quotes (""). 

"v=spf1 a -all"
unencodedBooleanWhether the TXT record's data is encoded.
  • 1 — Encoded.
  • 0Not encoded.
1

Note:

For more information about TXT records, read RFC 1464 at IANA.

Returns

This function only returns metadata.