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

 

Description

This function retrieves the disk space that an email account uses.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Email/get_disk_usage?user=user&domain=example.com


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List disk usage for user@example.com.
$disk_used = $cpanel->uapi(
    'Email', 'get_disk_usage',
    array(
        'user'         => 'user',
        'domain'       => 'example.com',
        )
);

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 disk usage for user@example.com.
my $disk_used = $cpliveapi->uapi(
    'Email', 'get_disk_usage',
    {
        'user'         => 'user',
        'domain'       => 'example.com',
    }
);

Note:

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

 

 cPanel Template Toolkit
<!-- Get a hash of disk use info, then display the diskused value. -->
[% data = execute('Email', 'get_disk_usage', { 'user' => 'user', 'domain' => 'example.com', } ) %]
[% FOREACH q = data.diskused %]
     <p>
         [% q %]
     </p>
[% END %]
    
<!-- Get only the disk use. -->
[% execute('Email', 'get_disk_usage', { 'user' => 'user', 'domain' => 'example.com', } ).data.diskused %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 

 Command Line
uapi --user=username Email get_disk_usage user=user domain=example.com

Notes:

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

 Output (JSON)
{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  

   },
   "data":{  
      "domain":"example.com",
      "diskused":0,
      "user":"user",
      "login":"user"
   }
}

Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

The email account username.

If you do not specify a value, the function returns information for the cPanel account's default address.

A valid email account username on the cPanel account.

For example, user if the email address is user@example.com.

user
domainstring

The email account's domain.

This parameter defaults to the cPanel account's main domain.

A valid domain on the cPanel account.

example.com

  Returns

ReturnTypeDescriptionPossible valuesExample

diskused

numericThe disk space that the email account uses.
  • A positive floating-point value that represents the disk space used in Megabytes (MB).
  • 0 — The account has an unlimited disk quota.
399.6

login

string

The email address, or the main account username.

  • A valid email address.
  • The main account's username.

user@example.com

domain

stringThe email account's domain.

The email account's domain.

For example, example.com if the email address is user@example.com.

example.com

user

stringThe email account username.

The email account's username.

For example, user if the email address is user@example.com.

user