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

 

Description

This function returns an account's disk usage statistics.

Warning:

We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.

Examples 


 WHM API (JSON)
https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_func=getdiskinfo

Note:

 For more information, read our Calls from the WHM API documentation.

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Return disk usage data.
$getdiskinfo = $cpanel->api2(
    'Fileman', 'getdiskinfo' 
);

Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Return disk usage data.
my $getdiskinfo = $cpliveapi->api2(
    'Fileman', 'getdiskinfo',	
);

Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Tag System (deprecated)

Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.

cPanel API 2 calls that use cPanel tags vary widely in code syntax and in their output. For more information, read our Deprecated cPanel Tag Usage documentation. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI.

 Command Line
cpapi2 --user=username Fileman getdiskinfo

Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to cPanel API 2 documentation or run the cpapi2 --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
 {
  "cpanelresult": {
    "apiversion": 2,
    "func": "getdiskinfo",
    "data": [
      {
        "spacelimit": "500",
        "file_upload_remain": "500",
        "filesused_humansize": "1.11 KB",
        "filesremain": "500",
        "spaceremain_humansize": "500",
        "filesused": 1138,
        "fileslimit_humansize": "500",
        "spaceremain": "500",
        "spaceused_humansize": "42.9 MB",
        "file_upload_remain_humansize": "500",
        "spaceused": 44985851,
        "file_upload_max_bytes_humansize": "90.95 TB",
        "file_upload_max_bytes": 99999999999999,
        "file_upload_must_leave_bytes": 5242880,
        "spacelimit_humansize": "500",
        "filesremain_humansize": "500",
        "file_upload_must_leave_bytes_humansize": "5 MB",
        "fileslimit": 0
      }
    ],
    "event": {
      "result": 1
    },
    "module": "Fileman"
  }
}

Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
spacelimitstringThe account's disk space quota.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞ — The account has unlimited disk space.
10 MB
file_upload_remainstringThe account's available file upload space.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
5 MB
filesused_humansizestring

The disk space that the files on the account use.

  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
1.11 KB

 
filesremainstringThe disk space that remains on the account.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
                
                 
              
spaceremain_humansizestringThe disk space that still remains on the account.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
filesusedintegerThe number of files on the account.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
1138
 
fileslimit_humansizestringThe account's disk space quota that is reserved for files.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.

 

0 bytes
spaceremainstringThe disk space that still remains on the account.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  •   — The account has unlimited disk space.
spaceused_humansizestringThe disk space that still remains on the account.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
42.9 MB
file_upload_remain_humansizestring

The file upload space that still remains on the account.

  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
spaceusedstringThe amount of disk space used.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
44985851
file_upload_max_bytes_humansize  stringThe amount of disk space that must be available to avoid quota issues due to file uploads.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
90.95 TB
file_upload_max_bytesstringThe maximum file size that you can upload through the File Manager.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞ — The account has unlimited disk space.
99999999999999
file_upload_must_leave_bytesstringThe amount of disk space that must be available to avoid quota issues due to file uploads.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞ — The account has unlimited disk space.
5242880
spacelimit_humansizestringThe account's disk space quota.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  • ∞  — The account has unlimited disk space.
filesremain_humansizestringThe upload file space that still remains on the account.
  • A positive integer, in Kilobytes (KB), Megabytes (MB), or Gigabytes (GB).
  •   — The account has unlimited disk space.
 
file_upload_must_leave_bytes_humansize
string

The amount of disk space that must be available to avoid issues due to file uploads.  

  • A positive integer that represents an amount of disk space in bytes.
5 MB
fileslimitstringThe account's disk space quota that is reserved for files.
  • A positive integer that represents an amount of disk space in bytes.

 

0
reasonstring

A reason for failure

Note:

This function only returns a reason value if there was an error.

A string that describes the error.This is an error message.
resultBoolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1