Child pages
  • WHM API 1 Functions - restartservice
Skip to end of metadata
Go to start of metadata

Description

This function restarts a service, or daemon, on a server.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/restartservice?api.version=1&service=exim
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/restartservice?api.version=1&service=exim
 Command Line
whmapi1 restartservice service=exim


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. 

 Output (JSON)
{
  "data": {
    "service": "exim"
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "output": {
      "raw":
 "Waiting for exim to restart....finished.\n\nexim (\/usr\/sbin\/exim 
-bd -q1h) running as mailnull with PID 3280 (pidfile check 
method)\n\nexim started ok\n"
    },
    "result": 1,
    "command": "restartservice"
  }
}
 Output (XML)
<result>
    <data>
        <service>exim</service>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <output>
            <raw>
                Waiting
 for exim to restart....finished. exim (/usr/sbin/exim -bd -q1h) running
 as mailnull with PID 3328 (pidfile check method) exim started ok
            </raw>
        </output>
        <result>1</result>
        <command>restartservice</command>
    </metadata>
</result>


Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample
servicestring

Required

The service to restart.

For a list of possible values, read our Service Manager documentation.

exim

Returns

ReturnTypeDescriptionPossible valuesExample

service

stringThe restarted service.For a list of possible values, read our Service Manager documentation.exim

output

string

The restartservice function's raw HTTP output.

A string of raw HTTP data.
 Click to view...

Waiting for httpd to restart..............finished.\n\nhttpd

(/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21379\n
httpd (/usr/local/apache/bin/httpd -k start -DSSL) running as root with PID 21385
\n\nhttpd started ok\n