Child pages
  • WHM API 1 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?api.version=1&domain=example.com
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/domainuserdata?api.version=1&domain=example.com
 Command Line
whmapi1 domainuserdata domain=example.com


Notes:

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

    /usr/local/cpanel/bin/whmapi1

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


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

   

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The account's main domain.

A valid domain name.example.com

Returns

ReturnTypeDescriptionPossible valuesExample
userdataarray of hashesAn array of hashes of domain information.Each hash contains the customlog, ifmodulemodsuphpc, and scriptalias hashes, and the documentroot, group, hascgi, homedir, ifmoduleconcurrentphpc, 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 array.

  • 1 — Enabled.
  • 0 — Disabled.
1

options

string

A list of domain options.

The function returns this value in the userdata array.

A space-separated list of option names.ExecCGI Includes

ip

string

The domain's IP address.

The function returns this value in the userdata array.

A valid IP address.10.0.0.1

hascgi

Boolean

Whether CGI is enabled for the account.

The function returns this value in the userdata array.

  • 1 — Enabled.
  • 0 — Disabled.
1

group

string

The account's group name.

The function returns this value in the userdata array.

A valid group name.reseller_username

usecanonicalname

string

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

The function returns this value in the userdata array.

  • On
  • Off
Off

scriptalias

hash

A hash of Apache ScriptAlias information.

The function returns this hash in the userdata array.

This hash contains 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 array.

A valid cPanel username.user

ifmodulemodsuphpc

hash

A hash of information about PHP scripts and suPHP.

The function returns this hash in the userdata array.

This hash contains the group return. 

group

string

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

owner

string

The WHM user who owns the cPanel account.

The function returns this value in the userdata array.

A valid WHM username.root

documentroot

string

The path to the domain's document root.

The function returns this value in the userdata array.

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 array.

  • On
  • Off
Off

serveralias

string

The domain's aliases.

The function returns this value in the userdata array.

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 array.

A valid port number.80

homedir

string

The path to the domain's home directory.

The function returns this value in the userdata array.

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 array.

One or more strings of module information. 

customlog

array of hashes

An array of hashes of Apache log information.

The function returns this array in the userdata array.

This hash contains 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 array.

A valid domain name.example.com

serveradmin

string

The account owner's contact email address.

The function returns this value in the userdata array.

A valid email address.owner@example.com