Child pages
  • WHM API 1 Functions - get_domain_info
Skip to end of metadata
Go to start of metadata

Description

This function returns information about each domain on the server.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/get_domain_info?api.version=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/get_domain_info?api.version=1
 Command Line
whmapi1 get_domain_info


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. 

 Output (JSON)
{  
   "metadata":{  
      "version":1,
      "command":"get_domain_info",
      "result":1,
      "reason":"OK"
   },
   "data":{  
      "domains":[
        {
	      "docroot":"/home/user1/public_html/example.com",
	      "domain":"example.com",
	      "domain_type":"addon",
	      "ipv4":"192.0.2.255",
	      "ipv4_ssl":"192.0.2.255",
	      "ipv6":"2001:DB8:g1m:0N3y:1",
	      "ipv6_is_dedicated":1,
	      "modsecurity_enabled":1,
	      "parent_domain":"example.com",
	      "php_version":"ea-php54",
	      "port":80,
		  "port_ssl":443,
	      "user":"username",
	      "user_owner":"user1"
        }
      ]
   }
}
 Output (XML)
<result>
	<metadata>
		<version>1</version>
		<command>get_domain_info</command>
		<result>1</result>
		<reason>OK</reason>
	</metadata>
	<data>
		<domains>
			<docroot>/home/user1/public_html/example.com</docroot>
			<domain>example.com</domain>
			<domain_type>addon</domain_type>
			<ipv4>192.0.2.255</ipv4>
			<ipv4_ssl>192.0.2.255</ipv4_ssl>
			<ipv6>2001:DB8:g1m:0N3y:1</ipv6>
			<ipv6_is_dedicated>1</ipv6_is_dedicated>
			<modsecurity_enabled>1</modsecurity_enabled>
			<parent_domain>example.com</parent_domain>
			<php_version>ea-php54</php_version>
			<port>80</port>
			<port_ssl>443</port_ssl>
			<user>username</user>
			<user_owner>user1</user_owner>
		</domains>
	</data>
</result>


Note:

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

Parameters

This function does not accept parameters.

Returns

Return

TypeDescriptionPossible valuesExample

domains

array of hashes

A array of hashes of the domain's data.

Note:

This return only includes domains that you manually created. This does not include proxy subdomains or automatically-created domains.

This array includes the docroot, user_owner, ipv4_ssl, modsecurity_enabled, ipv4, port_ssl, ipv6_is_dedicated, user, ipv6, php_version, domain, parent_domain, domain_type, and port returns.

 

docroot

string

The document root for the addon domain.

The function returns this value in the domains array.

An absolute file path.

/home/user1/public_html/example.com

domain

string

The account's main domain.

The function returns this value in the domains array.

A valid domain.example.com

domain_type

string

The domain's type.

The function returns this value in the domains array.

A valid string.addon

ipv4

string

The domain's IPv4 address.

The function returns this value in the domains array.

A valid IPv4 address.192.0.2.255

ipv4_ssl

string

The domain's secure IPv4 address.

The function returns this value in the domains array.

A valid IPv4 address.192.0.2.255

ipv6

string

The domain's IPv6 address.

The function returns this value in the domains array.

A valid IPv6 address.2001:DB8:g1m:0N3y::1

ipv6_is_detected

Boolean

The domain possesses an IPv6 address.

The function returns this value in the domains array.

  • 1 — An IPv6 address exists for this domain.
  • 0 — An IPv6 address does not exist for this domain.
1

modsecurity_enabled

Boolean

Whether ModSecurity™ is enabled on the server.

The function returns this value in the domains array.

  • 1 — ModSecurity is enabled.
  • 0 — ModSecurity is not enabled.
1

parent_domain

string

The parent domain.

The function returns this value in the domains array.

A valid domain name.example.com

php_version

string

The installed PHP versions.

The function returns this value in the domains array.

A valid string.ea-php54

port

integer

The server's port number.

The function returns this value in the domains array.

A valid positive integer.80

port_ssl

integer

The server's secure port number.

The function returns this value in the domains array.

A valid positive integer.443

user

string

The account username.

The function returns this value in the domains array.

A cPanel account or reseller username on the server.username

user_owner

string

The domain's owner.

The function returns this value in the domains array.

A valid string.user1