Page tree
Skip to end of metadata
Go to start of metadata

Description

This function lists user data for a domain.

Important:

This function retrieves data from the /var/cpanel/userdata/user/domain file, where user represents the cPanel account username and domain represents the domain.

  • Because aliases (parked domains) do not use a user data file, this function cannot query information for aliases. To retrieve information for an alias, specify the associated main or addon domain.
  • Due to differences in user data files, the function's 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/single_domain_data?domain=example.com

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', 'single_domain_data',
    array(
        'domain'    => 'example.com',
    )
);

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', 'single_domain_data',
    {
        'domain'    => 'example.com',
    }
);

Note:

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

 

 cPanel Template Toolkit
<!-- Get a hash of all the data, then display the ip value. -->
[% data = execute( 'DomainInfo', 'single_domain_data', { domain => 'example.com'} ); %]
[% FOREACH q = data.ip %]
     <p>
         [% q %]
     </p>
[% END %]
 
<!-- Get only the ip address. -->
[% execute('DomainInfo', 'single_domain_data', { domain => 'example.com' } ).data.ip %]

Note:

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

 

 Command Line
uapi --user=username DomainInfo single_domain_data domain=example.com

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. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
    
  },
  "data": {
    "phpopenbasedirprotect": "1",
    "options": "ExecCGI Includes",
    "ip": "192.168.0.128",
    "domain": "example.com",
    "hascgi": "1",
    "group": "user",
    "usecanonicalname": "Off",
    "scriptalias": [
      {
        "url": "/cgi-bin/",
        "path": "/home/user/public_html/cgi-bin"
      },
      {
        "url": "/cgi-bin/",
        "path": "/home/user/public_html/cgi-bin/"
      }
    ],
    "user": "user",
    "ifmodulemodsuphpc": {
      "group": "user"
    },
    "owner": "root",
    "documentroot": "/home/user/public_html",
    "userdirprotect": "1",
    "serveralias": "parkeddomain.com www.parkeddomain.com www.example.com",
    "port": "80",
    "homedir": "/home/user",
    "customlog": [
      {
        "target": "/usr/local/apache/domlogs/example.com",
        "domain": "combined"
      },
      {
        "target": "/usr/local/apache/domlogs/example.com-bytes_log",
        "domain": "\"%{%s}t %I .\\n%{%s}t %O .\""
      }
    ],
    "servername": "example.com",
    "type": "main_domain",
    "serveradmin": "webmaster@example.com"
  }
} 


Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain.

A valid domain on the cPanel account.

Important:

Do not specify an alias (parked domain).

example.com

 

Returns

ReturnTypeDescriptionPossible valuesExample
phpopenbasedirprotectBoolean

The domain's PHP open_basedir Tweak setting.

  • 1 — Enabled.
  • 0 — Disabled.
1
ipstring

The domain's IP address.

An IP address.

192.168.0.128
optionsstringThe Apache Options directive for the domain.A valid Options directive name.  ExecCGI Includes
domainstring

The domain name.

A valid domain on the cPanel account.
example.com
hascgiBooleanWhether CGI is enabled for the domain.
  • 1 — Enabled.
  • 0 — Disabled.
1
groupstringThe domain's group.

A group name.

user
usecanonicalnamestringThe domain's Canonical Name (CNAME) setting.
  • On — Use the CNAME.
  • OffDo not use the CNAME.
Off
scriptaliashashA hash of CGI information.This hash contains the url and path returns. 

url

string

The domain's CGI directory.

The function returns this value in the scriptalias hash.

The domain's CGI directory name./cgi-bin/

path

string

The path to the domain's CGI directory.

The function returns this value in the scriptalias hash.

The absolute path to the domain's CGI directory.
/home/user/public_html/cgi-bin
userstringThe cPanel account's username.The cPanel account's username.user
ifmodulemodsuphpchashA hash of information about PHP scripts and suPHP.This hash contains the group return. 
  groupstring

If suPHP is enabled, the group that PHP scripts run as.

The function returns this value in the ifmodulemodsuphpc hash.

A valid group name.user
ownerstringThe cPanel account's owner.The WHM account (root or a reseller) that owns the cPanel account.root
documentrootstringThe path to the domain's document root.The absolute path to the domain's document root.

/home/user/public_html/

userdirprotectBooleanThe domain's Apache mod_userdir Tweak setting.
  • 1 — Enabled.
  • 0 — Disabled.
1
serveraliasstringA list of the domain's aliases.A space-separated list of the domain's aliases.parkeddomain.com www.parkeddomain.com www.example.com
portinteger

Apache's port to access the domain.

 A valid port number.80
homedirstringThe path to the account's home directory.The absolute path to the account's home directory./home/user
customloghashA hash of Apache log information.This hash contains the target and domain returns. 

target

string

The absolute path to the domain's log file.

The function returns this value in the customlog hash.

The absolute path to a location in the server's domlogs directory.
/usr/local/apache/domlogs/example.com

domain

string

The target log file's domain.

The function returns this value in the customlog hash.

An Apache log domain.

Generally, this value is combined.

combined
servernamestringThe domain's identifier on the server.The domain's identifier on the server.example.com
typestringThe domain type.
  • addon_domain — The domain is an addon domain.
  • sub_domain — The domain is a subdomain.
  • main_domain — The domain is the account's main domain.
  • parked_domain — The domain is a parked domain (domain alias).
main_domain
serveradminstringThe domain's administrator's contact email address.A valid email address.webmaster@example.com