We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

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

Description

This function retrieves values from the /var/cpanel/cpanel.config file.

Note:

In cPanel & WHM version 86 and later, this function also retrieves values from the user's Exim configuration.

Examples 


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


Notes:

  • Unless otherwise noted, 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.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
	"data": {
		"tweaksetting": {
			"value": "localuser",
			"key": "defaultmailaction"
		}
	},
	"metadata": {
		"version": 1,
		"reason": "OK",
		"result": 1,
		"command": "get_tweaksetting"
	}
}
 Output (XML)
<result>
  <data>
    <tweaksetting>
      <value>localuser</value>
      <key>defaultmailaction</key>
    </tweaksetting>
  </data>
  <metadata>
    <version>1</version>
    <reason>OK</reason>
    <result>1</result>
    <command>get_tweaksetting</command>
  </metadata>
</result>


Note:

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

  Parameters

ParameterTypeDescriptionPossible valuesExample
key string

Required

The Tweak Settings option.

A valid string.defaultmailaction

module

string

The Tweak Settings section.

This value defaults to Main.

One of the following Tweak Setting module names:

  • Apache
  • Basic
  • Mail
  • Main
Main

Returns

ReturnTypeDescriptionPossible valuesExample
tweaksettinghashA hash of the tweak setting information.This hash includes the value and key returns.

value

string

The value.

The function returns this value in the tweaksetting hash.

This value depends on the key's requirements.localuser

key

string

The key.

The function returns this value in the tweaksetting hash.

A valid key name in the cpanel.config file.
defaultmailaction