Child pages
  • cPanel API 2 Functions - Ftp::listftpwithdisk

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

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


Warning
titleWarning:

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

  • Ftp::list_ftp_with_disk

    Excerpt Include
    DD:UAPI Functions - Ftp::list_ftp_with_diskDD:
    UAPI Functions - Ftp::list_ftp_with_disk
    nopaneltrue

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledFTPRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleWHM API (JSON)


Code Block
languagetext
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

Include Page
LIB:_CallFromWHMAPILink
LIB:_CallFromWHMAPILink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$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',
    ) 
);

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
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',
    }
);

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelAPI2cPanelTagsWarning
LIB:_cPanelAPI2cPanelTagsWarning


Expand
titleCommand Line


Code Block
languagebash
cpapi2 --user=username Ftp listftpwithdisk include_acct_types=main

Include Page
LIB:_cPanelAPI2CLINote
LIB:_cPanelAPI2CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
  "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"
  }
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

ParametersTypeDescriptionPossible valuesExample
dirhtmlstring

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_typesstring

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.
Note
titleNote:

Separate multiple types with the pipe (|) character.


                main
              
skip_acct_typesstring

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.
Note
titleNote:

Separate multiple types with the pipe (|) character.


                main
              

Returns

Return TypeDescriptionPossible valuesExample
diskquotastringThe account's disk quota, in Megabytes (MB).A positive integer value, or unlimited.
unlimited
diskusedpercentintegerThe percentage of space that the account uses.A positive integer value.0
diskusedintegerThe amount of space that the account uses, in Megabytes (MB).A positive integer value.0
humandiskquotastringThe 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
accttypestringThe 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
reldirstringThe relative path to the FTP user's document root.A valid relative path.
public_html/user
_diskusedintegerThe amount of space that the account uses, in bytes.A positive integer value.0
loginstringThe FTP account's username.A valid username.
user
dirstringThe path to the FTP user's document root.A valid absolute path.
/home/example/public_html/user
deleteableBooleanWhether you can delete the account.
  • 1 — You can delete this account.
  • 0 — You cannot delete this account.
1
serverloginstringThe full FTP login name.A username, at symbol (@), and the domain name
user@example.com
htmldirstringA null value.null is the only possible value.
null
humandiskusedstringThe 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
diskusedpercent20integerThe percentage of space that the account uses.A positive integer value.0
_diskquotaintegerThe amount of space that the account may use, in bytes.A positive integer value.0
reasonstring

A reason for failure.

Note
titleNote:

This function only returns a reason value if it failed.


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