Description

This function returns the built-in subdomain aliases for an account's main domain.

This function retrieves data from the /var/cpanel/userdata/user/domain file, where user represents the cPanel account username and domain represents the domain. For this reason, actual output may not contain all of the returns that this document lists.

Examples


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

$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Get domain user data.
$get_userdata = $cpanel->uapi(
    'DomainInfo', 'main_domain_builtin_subdomain_aliases',
    array(
        'format'    => 'hash',
    )
);

 

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Get domain user data.
my $get_userdata = $cpliveapi->uapi(
    'DomainInfo', 'main_domain_builtin_subdomain_aliases',
    {
        'format'    => 'hash',
    }
);

 

<!-- Get a hash of all the data, then display the addon_domains values. -->
[% data = execute( 'DomainInfo', 'main_domain_builtin_subdomain_aliases', { format => 'hash' } ); %]
[% FOREACH q = domains.data.addon_domains %]
     <p>
         [% q %]
     </p>
[% END %]
 
<!-- Get only the main_domain's domain name. -->
[% execute('DomainInfo', 'main_domain_builtin_subdomain_aliases', { format => 'hash' }).data.main_domain.domain %]

 

uapi --user=username DomainInfo domains format=hash

 {
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
    
  },
  "data": {
   "result": 
		"0":"mail",
		"1":"www",
  }
}
 {
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
    
  },
  "data": {
   "result": 
		"0":"mail",
		"1":"www",
  }
}

   

Parameters

This function accepts no parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
web_subdomain_aliasesarray

The type of subdomain alias.

  • 0mail subdomain
  • 1www subdomain

1