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/gethostname
- A server running WHM.
https://whm-server.tld:2087/json-api/gethostname
- 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/gethostname{ "data": { "hostname": "hostname.example.com" }, "metadata": { "command": "gethostname", "reason": "OK", "result": 1, "version": 1 } }
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/reboot
- A server running WHM.
https://whm-server.tld:2087/json-api/reboot
- 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/reboot?force=0'{ "metadata": { "command": "reboot", "reason": "OK", "result": 1, "version": 1 } }
Request
This function sets the primary domain hosted on an IP address and web server port. The primary domain refers to the virtual host that the server returns when a visitor directly accesses the IP address.
For example, if both example1.com and example2.com are name-based virtual hosts on IP address 192.168.0.1, the primary virtual host appears when the visitor accesses the http://192.168.0.1/ location.
Important:
When you disable the Web Server role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/set_primary_servername
- A server running WHM.
https://whm-server.tld:2087/json-api/set_primary_servername
- 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/set_primary_servername?servername=hostname.example.com&type=std'{ "metadata": { "command": "set_primary_servername", "reason": "OK", "result": 1, "version": 1 } }