UAPI - Output Columns

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:

parameter

Type

Description

Possible values

api.columns

 boolean 

Whether to enable column selection.

  • 1 — Enable column selection.
  • 0 — Disable 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

 

  }

 

}




  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....