We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

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

Description

This function returns all the directories where the system stores users' home directories. It returns them in descending order, based on the current amount of available free disk space for each directory. For example, the first directory the function lists has the most available free disk space.

Note:

Use WHM's Basic WebHost Manager Setup (WHM >> Home >> Server Configuration >> Basic WebHost Manager Setup) to configure where the system will create a new user's home directory.

Examples


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


Notes:

  • Unless otherwise noted, 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)
{
   "metadata" : {
      "reason" : "OK",
      "version" : 1,
      "result" : 1,
      "command" : "get_homedir_roots"
   },
   "data" : {
      "payload" : [
         {
            "path" : "/home"
         },
         {
            "path" : "/home2"
         }
      ]
   }
}


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

ReturnTypeDescriptionPossible valuesExample
payloadarray of hashesAn array containing data for each home parent directory.

This array contains the path return.


path

string

A directory where the system can store users' home directories.

This function returns this value in the payload array.

A valid directory path.

/home