You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

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

Description

This function calls a UAPI function through the WHM API. This function's output will match the UAPI function that it calls.

Note:

This function requires the list-accts Access Control List (ACL) privilege. For more information, read our Guide to WHM Plugins - ACL Reference Chart documentation.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/uapi_cpanel?api.version=1&cpanel.module=StatsBar&cpanel.function=get_stats&cpanel.user=username&display=addondomains%7Cbandwidthusage
 Command Line
whmapi1 uapi_cpanel cpanel.module=StatsBar cpanel.function=get_stats cpanel.user=username display="addondomains|bandwidthusage"


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":{
      "uapi":{
         "data":[
            {
               "zeroisunlimited":0,
               "maxed_phrase":"You are using your maximum allotment ([numf,_1]) of addon domains.",
               "_count":"0",
               "max":"unlimited",
               "percent":0,
               "near_limit_phrase":"You are using [numf,_1] of [numf,_2] available addon [numerate,_2,domain,domains].",
               "percent20":0,
               "_max":"unlimited",
               "id":"addondomains",
               "_maxed":0,
               "count":"0",
               "percent5":0,
               "feature":"addondomains",
               "is_maxed":0,
               "phrase":"Addon Domains",
               "module":"Park",
               "role":"WebServer",
               "name":"addondomains",
               "item":"Addon Domains",
               "percent10":0
            },
            {
               "zeroisunlimited":1,
               "maxed_phrase":"You have transferred your maximum allotment of data ([format_bytes,_1]) for this month.",
               "max":"unlimited",
               "normalized":1,
               "percent":0,
               "is_maxed":0,
               "feature":"bandwidth",
               "module":"Stats",
               "role":"WebServer",
               "percent10":0,
               "item":"Monthly Bandwidth Transfer",
               "_count":"0.00",
               "near_limit_phrase":"You have transferred [format_bytes,_1] of your [format_bytes,_2] data allotment for this month.",
               "percent20":0,
               "units":"MB",
               "_max":"unlimited",
               "id":"bandwidthusage",
               "_maxed":0,
               "percent5":0,
               "count":"0 bytes",
               "phrase":"Monthly Bandwidth Transfer",
               "name":"bandwidthusage"
            }
         ],
         "status":1,
         "messages":null,
         "errors":null,
         "warnings":null,
         "metadata":{
            "transformed":1
         }
      }
   },
   "metadata":{
      "reason":"OK",
      "result":1,
      "version":1,
      "command":"uapi_cpanel"
   }
}


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
cpanel.functionstring

Required

The UAPI function to call.

A valid UAPI function.

You must include the UAPI function's required parameters. You can also include its optional parameters.

For example, to call the UAPI get_stats function with its required display parameter and the bandwidthusage and diskusage values:

display=bandwidthusage|diskusage
get_stats
cpanel.modulestring

Required

The UAPI function's cPanel module.

A valid cPanel module.

Note:

This parameter is case-sensitive.

StatsBar
cpanel.userstring

Required

The cPanel username to call with the UAPI function.

A valid cPanel username.username

Returns

ReturnTypeDescriptionPossible valuesExample

uapi

hash

A hash of function output.

Each hash contains the returns from the called UAPI function.

For information about a function's returns, read the function's documentation.