Child pages
  • UAPI Functions - DomainInfo::domains_data

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function lists user data for the cPanel account's domains.


Note
titleNote:

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.


Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titlecPanel or Webmail Session URL


Code Block
languagetext
https://hostname.example.com:2083/cpsess##########/execute/DomainInfo/domains_data?format=hash&return_https_redirect_status=1

Include Page
LIB:_CallUAPIFromBrowserLink
LIB:_CallUAPIFromBrowserLink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Get domain user data.
$get_userdata = $cpanel->uapi(
    'DomainInfo', 'domains_data',
    array(
        'format'    => 'hash',
		'return_https_redirect_status' => '1',
    )
);

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


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

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titlecPanel Template Toolkit


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

Include Page
LIB:_TTLink
LIB:_TTLink
 


Expand
titleCommand Line


Code Block
uapi --user=username DomainInfo domains_data format=hash return_https_redirect_status=1

Include Page
LIB:_UAPICLINote
LIB:_UAPICLINote


Expand
titleOutput (JSON)


Localtab Group


Localtab
activetrue
titleformat=hash


Code Block
languagetext
linenumberstrue
 {
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
    
  },
  "data": {
    "addon_domains": [
      {
        "phpopenbasedirprotect": "1",
        "ip": "192.168.0.128",
        "domain": "seconddomain.com",
		"is_https_redirecting" : "0",
		"can_https_redirect" : "0",
		"all_aliases_valid" : "0",
        "usecanonicalname": "Off",
        "group": "user",
        "hascgi": "1",
        "user": "user",
        "documentroot": "/home/user/public_html/seconddomain.com",
        "owner": "root",
        "userdirprotect": "",
        "ipv6": null,
        "serveralias": "seconddomain.com www.seconddomain.com www.seconddomain.example.com",
        "homedir": "/home/user",
        "servername": "seconddomain.example.com",
        "type": "addon_domain",
        "serveradmin": "webmaster@seconddomain.example.com",
        "no_cache_update": "0"
      },
      {
        "phpopenbasedirprotect": "1",
        "ip": "192.168.0.128",
        "domain": "exampledomain.com",
		"is_https_redirecting" : "0",
		"can_https_redirect" : "0",
		"all_aliases_valid" : "0",
        "usecanonicalname": "Off",
        "group": "user",
        "hascgi": "1",
        "user": "user",
        "documentroot": "/home/user/public_html/subdomain",
        "owner": "root",
        "userdirprotect": "",
        "ipv6": null,
        "serveralias": "exampledomain.com www.exampledomain.com www.subdomain.example.com",
        "homedir": "/home/user",
        "servername": "subdomain.example.com",
        "type": "addon_domain",
        "serveradmin": "webmaster@subdomain.example.com",
        "no_cache_update": "0"
      },
      {
        "phpopenbasedirprotect": "1",
        "ip": "192.168.0.128",
        "domain": "addondomain.com",
		"is_https_redirecting" : "0",
		"can_https_redirect" : "0",
		"all_aliases_valid" : "0",
        "usecanonicalname": "Off",
        "group": "user",
        "hascgi": "1",
        "user": "user",
        "documentroot": "/home/user/addondomain/home/dir",
        "owner": "root",
        "userdirprotect": "",
        "ipv6": null,
        "serveralias": "addondomain.com www.addondomain.com www.subdomain.example.com",
        "homedir": "/home/user",
        "servername": "subdomain.example.com",
        "type": "addon_domain",
        "serveradmin": "webmaster@subdomain.example.com",
        "no_cache_update": "0"
      }
    ],
	"parked_with_https_redirects" : [
		"parkeddomain.com"
	],
	"parked_capable_of_https_redirects" : [
		"parkeddomain.com"
	],
    "parked_domains": [
      "parkeddomain.com"
    ],
    "sub_domains": [
      {
        "phpopenbasedirprotect": "1",
        "ip": "192.168.0.128",
        "domain": "sub.example.com",
		"is_https_redirecting" : "0",
		"can_https_redirect" : "0",
		"all_aliases_valid" : "0",
        "usecanonicalname": "Off",
        "group": "user",
        "hascgi": "1",
        "user": "user",
        "documentroot": "/home/user/public_html/sub",
        "owner": "root",
        "userdirprotect": "",
        "ipv6": null,
        "serveralias": "www.sub.example.com",
        "homedir": "/home/user",
        "servername": "sub.example.com",
        "type": "sub_domain",
        "serveradmin": "webmaster@sub.example.com",
        "no_cache_update": "0"
      }
    ],
    "main_domain": {
      "phpopenbasedirprotect": "1",
      "options": "ExecCGI Includes",
      "ip": "192.168.0.128",
      "domain": "example.com",
	  "is_https_redirecting" : "0",
	  "can_https_redirect" : "0",
	  "all_aliases_valid" : "0",
      "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": "",
      "serveralias": "parkeddomain.com www.parkeddomain.com www.example.com",
      "port": "80",
      "homedir": "/home/user",
      "customlog": [
        {
          "target": "/usr/local/apache/domlogs/example.com",
          "format": "combined"
        },
        {
          "target": "/usr/local/apache/domlogs/example.com-bytes_log",
          "format": "\"%{%s}t %I .\\n%{%s}t %O .\""
        }
      ],
      "servername": "example.com",
      "type": "main_domain",
      "serveradmin": "webmaster@example.com"
    }
  }
}



Localtab
titleformat=list


Code Block
languagetext
linenumberstrue
 {
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
    "transformed": 1
  },
  "data": [
    {
      "phpopenbasedirprotect": "1",
      "options": "ExecCGI Includes",
      "ip": "192.168.0.128",
      "domain": "example.com",
	  "is_https_redirecting" : "0",
      "can_https_redirect" : "0",
	  "all_aliases_valid" : "0",
      "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",
          "format": "combined"
        },
        {
          "target": "/usr/local/apache/domlogs/example.com-bytes_log",
          "format": "\"%{%s}t %I .\\n%{%s}t %O .\""
        }
      ],
      "servername": "example.com",
      "type": "main_domain",
      "serveradmin": "webmaster@example.com"
    },
	{
	  "parked_with_https_redirects[
		"parkeddomain.com"
		],
	},
	{
	   "parked_capable_of_https_redirects" : [
         "zippy.nugs.test"
        ],
	},
    {
      "phpopenbasedirprotect": "1",
      "ip": "192.168.0.128",
      "domain": "seconddomain.com",
	  "is_https_redirecting" : "0",
	  "all_aliases_valid" : "0",
      "can_https_redirect" : "0",
      "usecanonicalname": "Off",
      "group": "user",
      "hascgi": "1",
      "user": "user",
      "documentroot": "/home/user/public_html/seconddomain.com",
      "owner": "root",
      "userdirprotect": "",
      "ipv6": null,
      "serveralias": "seconddomain.com www.seconddomain.com www.seconddomain.example.com",
      "homedir": "/home/user",
      "servername": "seconddomain.example.com",
      "type": "addon_domain",
      "serveradmin": "webmaster@seconddomain.example.com",
      "no_cache_update": "0"
    },
    {
      "phpopenbasedirprotect": "1",
      "ip": "192.168.0.128",
      "domain": "exampledomain.com",
	  "is_https_redirecting" : "0",
	  "can_https_redirect" : "0",
	  "all_aliases_valid" : "0",
      "usecanonicalname": "Off",
      "group": "user",
      "hascgi": "1",
      "user": "user",
      "documentroot": "/home/user/public_html/subdomain",
      "owner": "root",
      "userdirprotect": "",
      "ipv6": null,
      "serveralias": "exampledomain.com www.exampledomain.com www.subdomain.example.com",
      "homedir": "/home/user",
      "servername": "subdomain.example.com",
      "type": "addon_domain",
      "serveradmin": "webmaster@subdomain.example.com",
      "no_cache_update": "0"
    },
    {
      "phpopenbasedirprotect": "1",
      "ip": "192.168.0.128",
      "domain": "addondomain.com",
	  "is_https_redirecting" : "0",
	  "can_https_redirect" : "0",
	  "all_aliases_valid" : "0",
      "usecanonicalname": "Off",
      "group": "user",
      "hascgi": "1",
      "user": "user",
      "documentroot": "/home/user/addondomain/home/dir",
      "owner": "root",
      "userdirprotect": "",
      "ipv6": null,
      "serveralias": "addondomain.com www.addondomain.com www.subdomain.example.com",
      "homedir": "/home/user",
      "servername": "subdomain.example.com",
      "type": "addon_domain",
      "serveradmin": "webmaster@subdomain.example.com",
      "no_cache_update": "0"
    },
    {
      "phpopenbasedirprotect": "1",
      "ip": "192.168.0.128",
      "domain": "sub.example.com",
	  "is_https_redirecting" : "0",
	  "can_https_redirect" : "0",
	  "all_aliases_valid" : "0",
      "usecanonicalname": "Off",
      "group": "user",
      "hascgi": "1",
      "user": "user",
      "documentroot": "/home/user/public_html/sub",
      "owner": "root",
      "userdirprotect": "",
      "ipv6": null,
      "serveralias": "www.sub.example.com",
      "homedir": "/home/user",
      "servername": "sub.example.com",
      "type": "sub_domain",
      "serveradmin": "webmaster@sub.example.com",
      "no_cache_update": "0"
    }
  ]
}




Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
formatstring

The function's return format.

This parameter defaults to hash.

  • hash — Use a hash format. This option returns the following hashes:
    • A hash that contains the addon_domains, parked_domains, and sub_domains arrays, each of which contain hashes for domains of those types.
    • A main_domain hash that contains the main domain's information.
  • list — Use a list format. This option returns an array of hashes, with one hash per domain.
hash
return_https_redirects_statusBoolean

Whether to return the secure redirect status of the addon domains.

Note
titleNote:

We added this parameter in cPanel & WHM version 80.

This parameter defaults to 0.

  • 1 — Return status.
  • 0 — Do not return status.
1

 

Returns

ReturnTypeDescriptionPossible valuesExample

addon_domains, parked_domains, or sub_domains

 

array

An array that contains hashes of domain information for each domain of that type.

Note
titleNotes:
  • The hash name indicates the type of domain.
  • The function only returns these hashes if you select the hash format.


Each array's hashes may contain any of the returns below. 
main_domainhash

A hash that contains the main domain's information.

Note
titleNote:

The function only returns this hash if you select the hash format.


This hash may contain any of the returns below. 
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.seconddomain.com
is_https_redirecting
Boolean

Whether the domain redirects to https.

Warning
titleImportant:

This return only appears if you set the return_https_redirects_status parameter to 1.


Note
titleNote:

We added this return in cPanel & WHM version 80.


  • 1 — Redirects.
  • 0 — Does not redirect.
0
can_https_redirect
Boolean

Whether a valid SSL certificate exists or AutoSSL runs on the domain.

Warning
titleImportant:

This return only appears if you set the return_https_redirects_status parameter to 1.


Note
titleNote:

We added this return in cPanel & WHM version 80.


  • 1 — A valid SSL certificate exists or AutoSSL runs.
  • 0 — A valid SSL certificate does not exist, and AutoSSL does not run.


0
all_aliases_validBoolean

Whether a valid SSL certificate exists on the domain's aliases.

Warning
titleImportant:

This return only appears if you set the return_https_redirects_status parameter to 1.


Note
titleNote:

We added this return in cPanel & WHM version 80.


  • 1 — A valid SSL certificate exists on the aliases.
  • 0 — A valid SSL certificate does not exist on the aliases.
0
usecanonicalnamestringThe domain's Canonical Name (CNAME) setting.
  • On — Use the CNAME.
  • OffDo not use the CNAME.
Off
groupstringThe domain's group.

A group name.

user
hascgiBooleanWhether CGI is enabled for the domain.
  • 1 — Enabled.
  • 0 — Disabled.
1
userstringThe cPanel account's username.The cPanel account's username.user
documentrootstringThe path to the domain's document root.The absolute path to the domain's document root./home/user/public_html/seconddomain.com
ownerstringThe cPanel account's owner.The WHM account (root or a reseller) that owns the cPanel account.root
userdirprotectBooleanThe domain's Apache mod_userdir Tweak setting.
  • 1 — Enabled.
  • 0 — Disabled.
1
ipv6stringThe domain's IPv6 address.
  • null — The account does not use IPv6.
  • An IPv6 address.
null
serveraliasstringA list of the domain's aliases.A space-separated list of the domain's aliases.seconddomain.com www.seconddomain.com www.seconddomain.example.com
homedirstringThe path to the account's home directory.The absolute path to the account's home directory./home/user
servernamestringThe domain's identifier on the server.The domain's identifier on the server.seconddomain.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).
addon_domain
serveradminstringThe domain's administrator's contact email address.A valid email address.webmaster@seconddomain.example.com
no_cache_updateBooleanWhether the domain is subject to cache updates.
  • 1 — Cache updates.
  • 0No cache updates.
0
scriptaliashash

A hash of CGI information.

Note
titleNote:

This hash only appears in the main_domain hash. 


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
ifmodulemodsuphpchash

A hash of information about PHP scripts and suPHP.

Note
titleNote:

This hash only appears in the main_domain hash. 


This hash contains the group return. 
   groupstring

If suPHP is enabled, PHP scripts run as this group.

The function returns this value in the ifmodulemodsuphpc hash.

A valid group name.user
customloghash

A hash of Apache log information.

Note
titleNote:

This hash only appears in the main_domain hash. 


This hash contains the target and format 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

format

string

The target log file's format.

The function returns this value in the customlog hash.

An Apache log format.

Generally, this value is combined.

combined
parked_with_https_redirectsarray

An array of parked domains that redirect to https.

Note
titleNote:

We added this return in cPanel & WHM version 80.


A list of parked domains on the account.parkeddomain.com
parked_capable_of_https_redirectsarray

An array of parked domains with valid SSL certificates or AutoSSL enabled.

Note
titleNote:

We added this return in cPanel & WHM version 80.


A list of parked domains on the account.parkeddomain.com