Description

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

Examples 




https://hostname.example.com:2083/cpsess##########/execute/Email/get_disk_usage?user=user&domain=example.com




$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',
        )
);

 



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',
    }
);

 



<!-- 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 %]

 



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



{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  

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



Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

Required

The email account username.

A valid email account username on the cPanel account.

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

user
domainstring

Required

The email account's 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 posesses 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