cPanel API 2 Functions - Ftp::listftpwithdisk

Warning:

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

Description

This function lists FTP users and their home directory's disk information.

Warning:

We strongly recommend that you use the following UAPI function instead of this function:

Important:

When you disable the FTP 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=Ftp&cpanel_jsonapi_func=listftpwithdisk&include_acct_types=main
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.

// List the account's FTP users.
$list_ftpdisk = $cpanel->api2(
    'Ftp', 'listftpwithdisk',
 array(
        'include_acct_types' => 'main',
    )
);
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.

# List the account's FTP users and disk information.
my $list_ftpdisk = $cpliveapi->api2(
    'Ftp', 'listftpwithdisk',
{
        'include_acct_types' => 'main',
    }
);
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 Ftp listftpwithdisk include_acct_types=main
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": "listftpwithdisk",
    "data": [
      {
        "diskquota": "unlimited",
        "diskusedpercent": 0,
        "diskused": 0,
        "humandiskquota": "None",
        "accttype": "main",
        "reldir": "",
        "_diskused": 0,
        "login": "example",
        "dir": "/home/example",
        "deleteable": 1,
        "serverlogin": "example",
        "htmldir": null,
        "humandiskused": "None",
        "diskusedpercent20": 0,
        "_diskquota": 0
      },
      {
        "diskquota": "unlimited",
        "diskusedpercent": 0,
        "diskused": 0,
        "humandiskquota": "None",
        "accttype": "logaccess",
        "reldir": "usr/local/apache/domlogs/example",
        "_diskused": 0,
        "login": "example_logs",
        "dir": "/usr/local/apache/domlogs/example",
        "deleteable": 1,
        "serverlogin": "example_logs",
        "htmldir": null,
        "humandiskused": "None",
        "diskusedpercent20": 0,
        "_diskquota": 0
      },
      {
        "diskquota": "unlimited",
        "diskusedpercent": 0,
        "diskused": 0,
        "humandiskquota": "None",
        "accttype": "sub",
        "reldir": "public_html/user",
        "_diskused": 0,
        "login": "user",
        "dir": "/home/example/public_html/user",
        "deleteable": 1,
        "serverlogin": "user@example.com",
        "htmldir": null,
        "humandiskused": "None",
        "diskusedpercent20": 0,
        "_diskquota": 0
      }
    ],
    "event": {
      "result": 1
    },
    "module": "Ftp"
  }
}
Note:

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


Parameters

Parameters Type Description Possible values Example
dirhtml string

A string to prepend to the dir return value.

This parameter defaults to the account's /home directory.

A valid string. example.com/
include_acct_types string

The types of account to view.

If you do not use this parameter, the function returns all FTP account types.

  • main — This is the main FTP account.
  • sub — This is a sub-user FTP account.
  • logaccess — This account is for logfile access.

Separate multiple types with the pipe (|) character.

main
skip_acct_types string

The types of account to exclude.

If you do not use this parameter, the function does not exclude any FTP account types.

  • main — This is the main FTP account.
  • sub — This is a sub-user FTP account.
  • logaccess — This account is for logfile access.

Separate multiple types with the pipe (|) character.

main

Returns

Return Type Description Possible values Example
diskquota string The account's disk quota, in megabytes (MB). A positive integer value, or unlimited. unlimited
diskusedpercent integer The percentage of space that the account uses. A positive integer value. 0
diskused integer The amount of space that the account uses, in megabytes (MB). A positive integer value. 0
humandiskquota string The amount of space that the account may use in a human-readable format, in megabytes (MB).
  • None — For no space used.
  • A positive integer value, followed by MB.
None
accttype string The type of FTP account.
  • main — This is the main FTP account.
  • sub — This is a sub-user FTP account.
  • logaccess — This account is for logfile access.
sub
reldir string The relative path to the FTP user's document root. A valid relative path. public_html/user
_diskused integer The amount of space that the account uses, in bytes. A positive integer value. 0
login string The FTP account's username. A valid username. user
dir string The path to the FTP user's document root. A valid absolute path. /home/example/public_html/user
deleteable Boolean Whether you can delete the account.
  • 1 — You can delete this account.
  • 0 — You cannot delete this account.
1
serverlogin string The full FTP login name. A username, at symbol (@), and the domain name user@example.com
htmldir string A null value. null is the only possible value. null
humandiskused string The amount of space that the account uses in a human-readable format, in megabytes (MB).
  • None — The account uses no disk space.
  • A positive integer, a space, and the string MB.
None
diskusedpercent20 integer The percentage of space that the account uses. A positive integer value. 0
_diskquota integer The amount of space that the account may use, in bytes. A positive integer value. 0
reason string

A reason for failure.

This function only returns a reason value if it failed.

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