Our documentation is getting an overhaul! We would like your input! Click here to take a look at the beta launch of our new documentation site! Only cPanel & WHM version 82 documentation exists on our beta at this time. 84 will be added to the new site soon! Leave your feedback here: https://go.cpanel.net/docsfeedback
WHM API 0 Functions - domainuserdata - Developer Documentation - cPanel Documentation
Child pages
  • WHM API 0 Functions - domainuserdata
Skip to end of metadata
Go to start of metadata

Description

This function retrieves domain data.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/domainuserdata?domain=example.com
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/domainuserdata?domain=example.com
 Command Line
whmapi0 domainuserdata domain=example.com


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 0 documentation or run the whmapi0 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi0 command:

    /usr/local/cpanel/bin/whmapi0

 Output (JSON)
{  
   "userdata":{  
      "phpopenbasedirprotect":1,
      "options":"ExecCGI Includes",
      "ip":"10.215.214.95",
      "hascgi":"1",
      "group":"reseller_name",
      "usecanonicalname":"Off",
      "scriptalias":[  
         {  
            "url":"/cgi-bin/",
            "path":"/home/username/public_html/cgi-bin"
         },
         {  
            "url":"/cgi-bin/",
            "path":"/home/username/public_html/cgi-bin/"
         }
      ],
      "user":"username",
      "ifmodulemodsuphpc":{  
         "group":"username"
      },
      "owner":"root",
      "documentroot":"/home/username/public_html",
      "userdirprotect":"",
      "serveralias":"parkeddomain.com www.parkeddomain.com www.example.com",
      "port":"80",
      "homedir":"/home/username",
      "ifmoduleconcurrentphpc":{  

      },
      "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",
      "serveradmin":"webmaster@example.com"
   },
   "result":[  
      {  
         "statusmsg":"Obtained userdata.",
         "status":1
      }
   ]
}
 Output (XML)
<domainuserdata>
    <result>
        <status>1</status>
        <statusmsg>Obtained userdata.</statusmsg>
    </result>
    <userdata>
        <customlog>
            <format>combined</format>
            <target>/usr/local/apache/domlogs/example.com</target>
        </customlog>
        <customlog>
            <format>"%{%s}t %I .\n%{%s}t %O ."</format>
            <target>/usr/local/apache/domlogs/example.com-bytes_log</target>
        </customlog>
        <documentroot>/home/username/public_html</documentroot>
        <group>reseller_username</group>
        <hascgi>1</hascgi>
        <homedir>/home/username</homedir>
        <ifmoduleconcurrentphpc/>
        <ifmodulemodsuphpc>
            <group>username</group>
        </ifmodulemodsuphpc>
        <ip>10.215.214.95</ip>
        <options>ExecCGI Includes</options>
        <owner>root</owner>
        <phpopenbasedirprotect>1</phpopenbasedirprotect>
        <port>80</port>
        <scriptalias>
            <path>/home/username/public_html/cgi-bin</path>
            <url>/cgi-bin/</url>
        </scriptalias>
        <scriptalias>
            <path>/home/username/public_html/cgi-bin/</path>
            <url>/cgi-bin/</url>
        </scriptalias>
        <serveradmin>webmaster@example.com</serveradmin>
        <serveralias>
            parkeddomain.com www.parkeddomain.com www.example.com
        </serveralias>
        <servername>example.com</servername>
        <usecanonicalname>Off</usecanonicalname>
        <user>username</user>
        <userdirprotect/>
    </userdata>
</domainuserdata>

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The account's main domain.

A valid domain name.example.com

Returns

ReturnTypeDescriptionPossible valuesExample
resultarray of hashesAn array of hashes of function status information.This hash includes the status and statusmsg returns. 

status

Boolean

Whether the function succeeded.

The function returns this value in the result hash.

  • 1 — Success.
  • 0 — Failure.
1

statusmsg

string

A message of success or a reason for failure.

The function returns this value in the result hash.

  • Obtained userdata.
  • An error message.
Obtained userdata.
userdatahashA hash of domain information.This hash includes the customlog and scriptalias arrays of hashes, the ifmodulemodsuphpc and ifmoduleconcurrentphpc hashes, and the documentroot, group, hascgi, homedir, ip, options, owner, phpopenbasedirprotect, port, serveradmin, serveralias, servername, usecanonicalname, user, and userdirprotect returns. 

phpopenbasedirprotect

Boolean

Whether the PHP open_basedir tweak is enabled.

The function returns this value in the userdata hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

options

string

A list of domain options.

The function returns this value in the userdata hash.

A space-separated list of option names.ExecCGI Includes

ip

string

The domain's IP address.

The function returns this parameter in the userdata hash.

A valid IPv4 address.10.0.0.1

hascgi

Boolean

Whether CGI is enabled for the account.

The function returns this parameter in the userdata hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

group

string

The account's group name.

The function returns this parameter in the userdata hash.

A valid group name.reseller_username

usecanonicalname

string

The domain's setting for canonical names (CNAMEs).

The function returns this parameter in the userdata hash.

  • On
  • Off
Off

scriptalias

array of hashes

An array of hashes of Apache ScriptAlias information.

The function returns this array in the userdata hash.

Each hash includes the url and path returns.

 

url

string

The alias URL. This URL redirects to the path URL.

The function returns this value in the scriptalias hash.

A valid URL or file path.

/cgi-bin/

path

string

The path to Apache's CGI scripts. The url alias redirects to this location.

The function returns this value in the scriptalias hash.

A valid URL or absolute file path.

/home/user/public_html/cgi-bin/

user

string

The cPanel account username.

The function returns this value in the userdata hash.

A valid cPanel username.user

ifmodulemodsuphpc

hash

A hash of information about PHP scripts and suPHP.

The function returns this hash in the userdata hash.

This hash includes the group return. 

group

string

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

The function returns this value in the ifmodulemodsuphpc hash.

A valid group name.user

owner

string

The WHM user who owns the cPanel account.

The function returns this value in the userdata hash.

A valid WHM username.root

documentroot

string

The path to the domain's public_html directory.

The function returns this value in the userdata hash.

A valid filepath.
/home/username/public_html

userdirprotect

string

The domain's setting for the Apache mod_userdir Tweak.

The function returns this value in the userdata hash.

  • On
  • Off
Off

serveralias

string

The domain's aliases.

The function returns this value in the userdata hash.

A space-separated list of domain aliases.parkeddomain.com www.parkeddomain.com seconddomain.com

port

integer

Apache's port to access the domain.

The function returns this value in the userdata hash.

A valid port number.80

homedir

string

The path to the domain's home directory.

The function returns this value in the userdata hash.

The absolute path to the domain's home directory.
/home/username

ifmoduleconcurrentphpc

hash

A hash of Apache module information.

The function returns this value in the userdata hash.

One or more strings of module information. 

customlog

array of hashes

A hash of Apache log information.

The function returns this array in the userdata hash.

Each hash includes the target and format returns. 

target

string

An Apache custom log's location.

The function returns this value in the customlog array.

The absolute path to the log file.
/usr/local/apache/domlogs/example.com

format

string

The custom log's format.

The function returns this value in the customlog array.

A valid Apache log format.combined

servername

string

The main domain on the domain's account.

The function returns this value in the userdata hash.

A valid domain name.example.com

serveradmin

string

The account owner's contact email address.

The function returns this value in the userdata hash.

A valid email address.owner@example.com