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

Description

This function enables or disables a service and its monitoring.

Examples


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


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)
{
  "metadata": {
    "version": 1,
    "reason": "Enabled monitoring for mysql.",
    "result": 1,
    "command": "configureservice"
  }
}
 Output (XML)
<result>
    <metadata>
        <version>1</version>
        <reason>Enabled monitoring for mysql.</reason>
        <result>1</result>
        <command>configureservice</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 configure.

For more information, read our Service Manager documentation.

  • apache_php_fpm
  • cpanel-dovecot-solr
  • cpanel_php_fpm
  • cpanellogd
  • cpdavd
  • cphulkd
  • cpsrvd
  • crond
  • dnsadmin
  • exim
  • exim-altport
  • ftpd
  • httpd
  • imap
  • ipaliases
  • lmtp
  • mailman
  • mysql
  • named
  • nscd
  • p0f
  • pop
  • queueprocd
  • rsyslogd
  • spamd
  • sshd
mysql
enabledBoolean

Whether to enable the service.

If you do not use this parameter, the function will not change the enabled status of the service.

Warning:

Do not use this function to disable the cpsrvd service.

  • 1 — Enable the service.
  • 0 — Disable the service.
 1
monitoredBoolean

Whether to monitor the service in WHM's Service Status interface (Home >> Server Status >> Service Status).

If you do not use this parameter, the function will not change the monitoring status of the service.

  • 1 — Monitor the service.
  • 0 — Do not monitor the service.
 1
exim-altportnuminteger

The alternative port or ports on which Exim will listen for inbound connections.

Notes:

  • The function only uses this parameter if you set exim-altport as the service parameter's value.
  • We introduced this parameter in cPanel & WHM version 68. 

This parameter defaults to 26.

A comma-separated list of integers.26

Returns

This function only returns metadata.