cPanel API 2 Functions - Fileman::getdiskinfo

Warning:

The cPanel API 2 system is deprecated. We strongly recommend that you use UAPI instead of cPanel API 2.

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.

Important:

When you disable the File Storage role, the system disables this function.


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)

Warnings:
  • cPanel tags are deprecated . We strongly recommend that you only use the LiveAPI system to call the cPanel APIs. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI .
  • cPanel API 2 calls that use cPanel tags vary in code syntax and in their output.
  • For more information, read our Deprecated cPanel Tag Usage documentation.

Command Line

cpapi2 --user=username Fileman getdiskinfo
Notes:
  • You must URI-encode values.
  • username represents your account-level username.
  • You must include the --user=username option.
  • For more information and additional output options, read our Guide to cPanel API 2 documentation or run the cpapi2 --help command.
  • If you run CloudLinux™, you must use the full path of the cpapi2 command:
    /usr/local/cpanel/bin/cpapi2

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

Return Type Description Possible values Example
spacelimit string The 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_remain string The 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_humansize string

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
filesremain string The 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_humansize string The 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.
filesused integer The 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_humansize string The 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
spaceremain string The 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_humansize string The 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_humansize string

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.
spaceused string The 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 string The 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_bytes string The 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_bytes string The 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_humansize string The account's disk space quota.
  • A positive integer, in kilobytes (KB), megabytes (MB), or gigabytes (GB).
  • — The account has unlimited disk space.
filesremain_humansize string The 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
fileslimit string The account's disk space quota that is reserved for files.
  • A positive integer that represents an amount of disk space in bytes.
0
reason string

A reason for failure

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

A string that describes the error. This is an error message.
result Boolean

Whether the function succeeded.

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