WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function restarts a service, or daemon, on a server.
Note:
If the user only possesses the clustering Access Control List (ACL) then this function can only act on the named service.
The service to restart. For a list of possible values, read our Access Control List (ACL) documentation.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/restartservice
- A server running WHM.
https://whm-server.tld:2087/json-api/restartservice
- 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/restartservice?service=exim&queue_task=0'{ "data": { "output": "Waiting for httpd to restart..............finished.\\n\\nhttpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21379\\nhttpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21385\\n\\nhttpd started ok\\n", "service": "exim" }, "metadata": { "command": "restartservice", "reason": "OK", "result": 1, "version": 1 } }
The service for which to view the status.
Notes
If you do not specify this parameter, the function will return the status for all of your server's services.
Available Services:
- apache_php_fpm
- clamd
- cpanel-dovecot-solr
- cpanel_php_fpm
- cpanellogd
- cpdavd
- cpgreylistd
- cphulkd
- cpsrvd
- crond
- dnsadmin
- exim
- exim-altport
- ftpd
- httpd
- imap
- ipaliases
- lmtp
- mailman
- mysql
- named
- nscd
- p0f
- pop
- postgresql
- queueprocd
- rsyslogd
- spamd
- sshd
- syslogd
- tailwatchd
For more information about these services, read our Service Manager documentation.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/servicestatus
- A server running WHM.
https://whm-server.tld:2087/json-api/servicestatus
- 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/servicestatus?service=crond'{ "data": { "service": [ … ] }, "metadata": { "command": "servicestatus", "reason": "OK", "result": 1, "version": 1 } }
The configuration key's name.
- This parameter uses the key names listed in the
/var/cpanel/conf/{service}/mainfile, where {service} is the service's name from the service parameter. - This function does not support subkeys.
The service's name.
- A list of service names exists in the
/var/cpanel/confdirectory.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/set_service_config_key
- A server running WHM.
https://whm-server.tld:2087/json-api/set_service_config_key
- 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_service_config_key?key=mail_process_size&service=dovecot&value=512'{ "metadata": { "command": "set_service_config_key", "reason": "Succeeded", "result": 1, "version": 1 } }