Page tree
Skip to end of metadata
Go to start of metadata

 

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.
  • If you sort the results of your API function call, you must use a displayed column as a sort key.

Select columns for output

UAPI column selection uses two basic parameters:

parameterTypeDescriptionPossible values
api.columns booleanWhether to enable column selection.
  • 1 — Enable column selection.
  • 0 — Disable column selection.
api.columns_0string

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.

/execute/SSL/installed_hosts?api.columns=1&api.columns_0=ip&api.columns_1=domains

Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

$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',
    ) 
);

Note:

For more information, read our Guide to the LiveAPI System.

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',
    }
);

Note:

For more information, read our Guide to the LiveAPI System.

<!-- List the ip and domains of installed SSL hosts. -->
[% execute('SSL', 'installed_hosts', { 'api.columns' => '1', 'api.columns_0' => 'ip', 'api.columns_1' => 'domains', }) %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

{
  "messages": null,
  "errors": null,
  "status": 1,
  "data": [
    {
      "ip": "192.168.81.0",
      "domains":"example.com",
    }
  ],
  "metadata": {
    "transformed": 1
  }
}