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

Description

This function lists the disk usage status of the system's user accounts. This also lists information about file system object (inode) usage.

Warning:

On most servers, this function returns a large amount of input. We strongly recommend that you filter and sort the output. The following example uses the filter and sort options:

 Click to view...
https://hostname.example.com:2087/cpsess##########/json-api/get_disk_usage?api.version=1&api.filter.enable=1&api.filter.a.field=user&api.filter.a.type=eq&api.filter.a.arg0=username

Examples


 JSON API

https://hostname.example.com:2087/cpsess##########/json-api/get_disk_usage?api.version=1

 Command Line
whmapi1 get_disk_usage


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)

{
   "data":{
      "accounts":[
         {
            "blocks_used":2632,
            "blocks_limit":null,
            "inodes_limit":9999,
            "user":"username",
            "inodes_used":340
         },
         {
            "inodes_used":194,
            "user":"username2",
            "inodes_limit":null,
            "blocks_limit":null,
            "blocks_used":2108
         },
         {
            "blocks_used":1648,
            "blocks_limit":"81920",
            "inodes_limit":null,
            "user":"username3",
            "inodes_used":77
         },
         {
            "blocks_limit":null,
            "blocks_used":1752,
            "user":"username4",
            "inodes_used":89,
            "inodes_limit":null
         },
         {
            "blocks_used":1768,
            "blocks_limit":null,
            "inodes_limit":null,
            "user":"username5",
            "inodes_used":93
         }
      ]
   }
}


Note:

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

Parameters

This function does not accept any parameters.

Returns

ReturnTypeDescriptionPossible valuesExample

accounts

array of hashesAn array of hashes containing the disk usage data for all accounts on the server.

Each hash contains the blocks_limit, blocks_used, inodes_limit, inodes_used, and user returns.


blocks_limit

integer

The account's disk space quota.

This function returns this value in the accounts hash.

  • A maximum amount of disk space, in kibibytes (KiB).
  • null — The account has unlimited disk space.
null

blocks_used

integer

The account's current disk space usage.

This function returns this value in the accounts hash.

A positive integer that represents the used disk space, kibibytes (KiB).2632

inodes_limit

integer

The account's inode quota.

This function returns this value in the accounts hash.

  • A maximum number of inodes.
  • null — The account has an unlimited number of inodes.
9999

inodes_used

integer

The account's current inode usage.

This function returns this value in the accounts hash.

A positive integer that represents the number of used inodes.340

user

string

The account username.

This function returns this value in the accounts hash.

A valid cPanel account or reseller username on the server.username