Child pages
  • UAPI Functions - DomainInfo::main_domain_builtin_subdomain_aliases
Skip to end of metadata
Go to start of metadata

 

Description

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

Note:

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


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


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.
 
// Get domain user data.
$get_userdata = $cpanel->uapi(
    'DomainInfo', 'main_domain_builtin_subdomain_aliases',
    array(
        'format'    => 'hash',
    )
);


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.
 
# Get domain user data.
my $get_userdata = $cpliveapi->uapi(
    'DomainInfo', 'main_domain_builtin_subdomain_aliases',
    {
        'format'    => 'hash',
    }
);


Note:

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

 

 cPanel Template Toolkit
<!-- 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 %]


Note:

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

 

 Command Line
uapi --user=username DomainInfo domains format=hash


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": {
    
  },
  "data": {
   "result": 
		"0":"mail",
		"1":"www",
  }
}
 {
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
    
  },
  "data": {
   "result": 
		"0":"mail",
		"1":"www",
  }
}


Note:

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

   

Parameters

This function accepts no parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
web_subdomain_aliasesarray

The type of subdomain alias.

  • 0mail subdomain
  • 1www subdomain

1