Introduction
You can use additional parameters to select the parameters to display in UAPI output.
Notes:
- cPanel & WHM introduced this feature in version 11.48.
Select columns for output
UAPI column selection uses two basic parameters:
parameter |
Type |
Description |
Possible values |
api.columns |
boolean |
Whether to enable column selection. |
|
api.columns_0 |
string |
The output parameter to display. Note: To display more than one column, increment the parameter name. For example, to display three columns, use the api.columns_1,api.columns_2, and api.columns_3 parameters. |
The name of one of the function's parameters. |
Examples
The following example function calls execute the SSL::installed_hosts
function and displays the ip
and domains
parameters.
cPanel or Webmail Session URL
/execute/SSL/installed_hosts?api.columns=1&api.columns_0=ip&api.columns_1=domains
LiveAPI PHP Class
$cpanel
=
new
CPANEL();
// Connect to cPanel - only do this once.
// List the ip and domains of installed SSL hosts.
$list_by_disk
=
$cpanel
->api2(
'SSL'
,
'installed_hosts'
,
array
(
'api.columns'
=>
'1'
,
'api.columns_0'
=>
'ip'
,
'api.columns_1'
=>
'domains'
,
)
);
LiveAPI Perl Class
my
$cpliveapi
= Cpanel::LiveAPI->new();
# Connect to cPanel - only do this once.
# List the ip and domains of installed SSL hosts.
my
$list_by_disk
=
$cpliveapi
->api2(
'SSL'
,
'installed_hosts'
,
{
'api.columns'
=>
'1'
,
'api.columns_0'
=>
'ip'
,
'api.columns_1'
=>
'domains'
,
}
);
cPanel Template Toolkit
<!-- List the ip and domains of installed SSL hosts. -->
[% execute('SSL', 'installed_hosts', { 'api.columns' => '1', 'api.columns_0' => 'ip', 'api.columns_1' => 'domains', }) %]
Output (JSON)
{
"messages": null,
"errors": null,
"status": 1,
"data": [
{
"ip": "192.168.81.0",
"domains":"example.com",
}
],
"metadata": {
"transformed": 1
}
}