WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/export_zone_files
- A server running WHM.
https://whm-server.tld:2087/json-api/export_zone_files
- 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/export_zone_files?zone=example.com%2Cexample.net'{ "data": { "payload": [ … ] }, "metadata": { "command": "export_zone_files", "reason": "OK", "result": 1, "version": 1 } }
Request
This function returns a line from a domain's DNS zone configuration.
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.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/getzonerecord
- A server running WHM.
https://whm-server.tld:2087/json-api/getzonerecord
- 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/getzonerecord?domain=example.com&line=2'{ "data": { "record": [ … ] }, "metadata": { "command": "getzonerecord", "reason": "Record obtained.", "result": 1, "version": 1 } }
Request
This function deletes a DNS zone.
Important:
- The WHM API 1 adddns function adds an XDNS entry for a domain in the following locations:
- The
/var/cpanel/users/USERfile, whereUSERrepresents the domain's owner. - The
/etc/vdomainaliases/DOMAINdirectory, whereDOMAINrepresents the new zone's domain. - The
/etc/vfilters/DOMAINdirectory, whereDOMAINrepresents the new zone's domain. - This function does not automatically delete these entries. You must manually delete these entries, or you cannot use this domain as a value in other API functions.
- You cannot delete other DNS zones that reside on Write-only servers in a DNS cluster.
Important:
When you disable the DNS role, the system disables this function.
NOTE:
You cannot use this function to delete temporary domains.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/killdns
- A server running WHM.
https://whm-server.tld:2087/json-api/killdns
- 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/killdns?domain=example.com'{ "metadata": { "command": "killdns", "output": { … }, "reason": "Zones Removed", "result": 1, "version": 1 } }