UAPI Functions - DomainInfo::list_domains

Description

This function lists the cPanel account's domains.

Note:

For this function to succeed, the /var/cpanel/userdata/username/main file (where username represents the authenticated user)must possess the correct permissions. If a permissions error occurs, this function returns blank values for all of its returns and doesnot return an error message.

Examples 


 cPanel or Webmail Session URL

https://hostname.example.com:2083/cpsess##########/execute/DomainInfo/list_domains

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// List the account's domains.
$get_domain_list $cpanel->uapi(
    'DomainInfo''list_domains'
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
# List the account's domains.
my $get_domain_list $cpliveapi->uapi(
    'DomainInfo''list_domains',
);

 cPanel Template Toolkit

<!-- Get a hash of all the data, then display the addon_domains values. -->
[% data = execute( 'DomainInfo', 'list_domains' ); %]
[% FOREACH q = data.addon_domains %]
     <p>
         [% q %]
     </p>
[% END %]
  
<!-- Get only the addon_domains list. -->
[% execute('DomainInfo', 'list_domains').data.main_domain.domain %]

 Command Line

uapi --user=username DomainInfo list_domains

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

{
    "messages": null,
    "errors": null,
    "status": 1,
    "metadata": {},
    "data": {
        "addon_domains": [
            "addondomain.com"
        ],
        "sub_domains": [
            "subdomain.example.com"
        ],
        "parked_domains": [
            "parkeddomain.com"
        ],
        "main_domain": "example.com"
    }
}

 

Note:

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

 

Parameters

This function does not accept parameters.

Returns

Note:

For this function to succeed, the /var/cpanel/userdata/username/main file (where username represents the authenticated user)must possess the correct permissions. If a permissions error occurs, this function returns blank values for all of its returns and doesnot return an error message.

Return

Type

Description

Possible values

Example

 addon_domains 

 array

An array of addon domains.

 An array of string values that lists the addon domains on the cPanel account. 

addondomain.com

sub_domains

array

An array of subdomains.

An array of string values that lists the subdomains on the cPanel account.

 subdomain.example.com 

 parked_domains 

 array 

 An array of parked domains. 

 An array of string values that lists the parked domains on the cPanel account. 

parkeddomain.com

 

  • 4 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....