Our documentation is getting an overhaul! We would like your input! Click here to take a look at the beta launch of our new documentation site! Only cPanel & WHM version 82 documentation exists on our beta at this time. 84 will be added to the new site soon! Leave your feedback here: https://go.cpanel.net/docsfeedback
UAPI Functions - WebVhosts::list_domains - Developer Documentation - cPanel Documentation
Child pages
  • UAPI Functions - WebVhosts::list_domains
Skip to end of metadata
Go to start of metadata

Description

This function lists virtual host names for each domain.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/WebVhosts/list_domains


Note:

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

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List vhosts for each domain.
$list_vhosts = $cpanel->uapi(
    'WebVhosts', 'list_domains'
);


Note:

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


 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# List vhosts for each domain.
my $list_vhosts = $cpliveapi->uapi(
    'WebVhosts', 'list_domains',
);


Note:

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


 Command Line
uapi --user=username WebVhosts list_domains


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  
      "transformed":1
   },
   "data": [
      {  
        "domain":"example.com",
		"vhost_is_ssl":1,
		"proxy_subodmains": [
		  "cpanel",
		  "webmail",
		  "autodiscover",
		  "whm",
		  "webdisk",
		],
		"vhost_name":"hostname.example.com"      
      },
      {
        "domain":"example2.com",
		"vhost_is_ssl":0,
		"vhost_name":"hostname.example.com"
      },
   ],
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
domainstring

The domain name.

The function returns this value in the unnamed hash.

A valid domain name on the virtual host.example.com
vhost_is_sslBoolean

Whether an SSL certificate secures the domain.

The function returns this value in the unnamed hash.

  • 1 — Secured.
  • 0Not secured.
1
proxy_subdomainsarray

An array of service subdomains (proxy subdomains) listed for the domain.

Note:

  • This only returns values when vhost_is_ssl is equal to 1.
  • We introduced this return in cPanel & WHM version 64.
The function returns this value in the unnamed hash.
  • null
  • An array of service subdomains (proxy subdomains).
cpanel, webmail, autodiscover, whm, webdisk

vhost_name

string

The name of the virtual host.

A valid host's name on the account.
hostname.example.com