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

 

Description

This function retrieves the server's hostname.

Examples 


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

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

 Output (JSON)
{
   "hostname":"hostname.example.com"
}
 Output (XML)
<gethostname>
     <hostname>hostname.example.com</hostname> 
</gethostname>

   

Parameters

This function does not accept parameters. 

Returns

ReturnTypeDescriptionPossible valuesExample
gethostnamehash

A hash of the hostname information.

This hash includes the hostname return. 

hostname

string

The server's hostname.

The function returns this value in the gethostname hash.

A valid hostname.hostname.example.com