WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function creates a DNS zone. If trueowner=user, this function does the following:
- Adds a DNS entry in the
/var/cpanel/users/USERfile, whereUSERrepresents thetrueownerparameter's value. - Creates the
/etc/vdomainaliases/DOMAINfile, whereDOMAINrepresents the new zone's domain. - Creates the
/etc/vfilters/DOMAINfile, whereDOMAINrepresents 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.
Important:
When you disable the DNS role, the system disables this function.
NOTE:
You cannot use this function to add temporary domains.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/adddns
- A server running WHM.
https://whm-server.tld:2087/json-api/adddns
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/adddns?domain=example.com&ip=192.168.0.20&ipv6=2001%3A0db8%3A0%3A0%3A1%3A0%3A0%3A1&template=standard&trueowner=user'{ "metadata": { "command": "adddns", "reason": "Added example.com ok belonging to user user", "result": 1, "version": 1 } }
Request
This function queries whether nameservers in a DNS cluster can share records with one another. Servers in a DNS cluster must exist in a Reverse Trust relationship to share information. This relationship requires each server to have an API token.
Note:
DNS servers in a Write-Only role do not need to exist in a Reverse Trust relationship. For more information, read our Guide to DNS Cluster Configurations documentation.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/cluster_member_has_trust_with
- A server running WHM.
https://whm-server.tld:2087/json-api/cluster_member_has_trust_with
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/cluster_member_has_trust_with?host=192.0.2.0&althost=192.0.3.0'{ "data": { "has_trust": 1 }, "metadata": { "command": "cluster_member_has_trust_with", "reason": "OK", "result": 1, "version": 1 } }
Request
This function edits a DNS zone record. To effectively use this function, use the following workflow:
- Run the
dumpzonefunction on the DNS zone record to edit. - Locate the
Linevalue that corresponds to the data to edit. - Use the values from that zone record to formulate the appropriate
editzonerecordparameters.
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
swapipscript or thesetsiteipfunction 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 Red Hat Bugzilla case about SPF record errors.
Important:
When you disable the DNS role, the system disables this function.
The updated DNS Zone Record.
The record's class.
If you do not use this parameter, the system retains the current setting.
The record's class.
If you do not use this parameter, the system retains the current setting.
The record's class.
If you do not use this parameter, the system retains the current setting.
The record's name.
If you do not use this parameter, the system retains the current setting.
Note:
Do not omit any necessary trailing periods.
You cannot use this function to modify temporary domains.
The DNS record type:
A- A records store IPv4 addresses. Use them to map a hostname to an IPv4 address.A6- A6 records store IPv6 addresses.AAAA- AAAA records store IPv6 addresses.AFSDB- AFSDB records store the location of an AFS cell's database servers.ALIAS- ALIAS records create an alias to another hostname, but can coexist with other records on that name. We strongly discourage using this record type.CAA- CAA records control which certificate authorities can issue SSL certificates for a domain.CNAME- CNAME records create an alias to another hostname.DNAME- DNAME records create an alias for a hostname and its subnames.DS- DS records specify a record's delegation signer.HINFO- HINFO records specify a host's CPU and OS types.LOC- LOC records store a hostname's geographical location.MX- MX records point a domain name to its MTAs.NS- NS records store a domain's authoritative nameservers.PTR- PTR records point to a CNAME.RP- RP records store a domain's Responsible Person's information.SOA- SOA records designate the beginning of a zone of authority.SRV- SRV records store the service location records for newer protocols (for example, Autodiscover).TXT- TXT records store descriptive text or useful records (for example, SPF or DKIM records).
If you do not use this parameter, the system retains the current setting.
Warning:
Additional properties may be required based on the type.
When you call this function, you must include the additional parameters for the desired zone record type if you use this parameter. Select a zone record from the menu to view the required additional parameters:
- A
- A6
- AAAA
- AFSDB
- ALIAS
- CAA
- CNAME
- DNAME
- DS
- HINFO
- LOC
- MX
- NS
- PTR
- RP
- SOA
- SRV
- TXT
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/editzonerecord
- A server running WHM.
https://whm-server.tld:2087/json-api/editzonerecord
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/editzonerecord \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d class=IN \
-d domain=example.com \
-d line=24 \
-d name=hostname.example.com. \
-d ttl=86400 \
-d type=A \
-d address=192.168.0.20{ "metadata": { "command": "editzonerecord", "reason": "Bind reloading on hostname using rndc zone: [example.com]\n", "result": 1, "version": 1 } }