Description

This function modifies a cPanel account's bandwidth quota.

Examples 


https://hostname.example.com:2087/cpsess##########/json-api/limitbw?user=username&bwlimit=0
https://hostname.example.com:2087/cpsess##########/xml-api/limitbw?user=username&bwlimit=0
whmapi0 limitbw user=username bwlimit=0

{  
   "result":[  
      {  
         "bwlimit":{  
            "unlimited":1,
            "bwlimit":0,
            "bwlimitenable":0,
            "domains":[  
               "addondomain.com",
               "seconddomain.com",
               "seconddomain.example.com",
               "subdomain.example.com",
               "example.com"
            ],
            "human_bwlimit":"unlimited",
            "human_bwused":"none"
         },
         "statusmsg":"Bandwidth Limit for username has been set to unlimited megabytes",
         "status":1
      }
   ]
}
<limitbw>
    <result>
        <bwlimit>
            <bwlimit>0</bwlimit>
            <bwlimitenable>0</bwlimitenable>
            <domains>addondomain.com</domains>
            <domains>seconddomain.com</domains>
            <domains>seconddomain.example.com</domains>
            <domains>subdomain.example.com</domains>
            <domains>example.com</domains>
            <human_bwlimit>unlimited</human_bwlimit>
            <human_bwused>none</human_bwused>
            <unlimited>1</unlimited>
        </bwlimit>
        <status>1</status>
        <statusmsg>
            Bandwidth Limit for username has been set to unlimited megabytes
        </statusmsg>
    </result>
</limitbw>

   

Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

Required

The account's username.

The username of a cPanel account on the server.

username
bwlimitstring

The account's new bandwidth quota.

This parameter defaults to unlimited.

  • A positive integer that represents a maximum monthly bandwidth use, in Megabytes (MB).
  • 0 or unlimited, to grant the user unlimited bandwidth.
0

 

Returns

ReturnTypeDescriptionPossible valuesExample
resultarray of hashesAn array of hashes of function data.This hash includes the bwlimit hash and the statusmsg and status returns. 

bwlimit

hash

A hash of account information.

The function returns this hash in the result hash.

This hash includes the unlimited, bwlimit, bwlimitenable, human_bwlimit, and human_bwused returns, and the domains array. 

unlimited

Boolean

Whether the account's bandwidth quota is unlimited.

The function returns this value in the bwlimit hash.

  • 1 — Unlimited.
  • 0Not unlimited.
1

bwlimit

integer

The account's new bandwidth quota.

The function returns this value in the bwlimit hash.

  • A positive integer that represents a maximum monthly bandwidth use, in Megabytes (MB).
  • 0 — The account possesses unlimited bandwidth.
0

bwlimitenable

Boolean

Whether bandwidth limiting is enabled for the account.

The function returns this value in the bwlimit hash.

  • 1 — Enabled.
  • 0 — Disabled.
0

domains

array

An array of the account's domains.

The function returns this array in the bwlimit hash.

An array of all of the cPanel account's domains.example.com

human_bwlimit

string

The account's bandwidth quota, in human-readable format.

The function returns this value in the bwlimit hash.

  • unlimited — The account possesses unlimited bandwidth.
  • A positive integer that represents a maximum monthly bandwidth use, a space, and the string MB.
500 MB

human_bwused

string

The account's current bandwidth usage, in human-readable format.

The function returns this value in the bwlimit hash.

  • none
  • A positive integer that represents the amount of bandwidth used, a space, and the string MB.
none

status

Boolean

Whether the system successfully called the function.

The function returns this value in the result hash.

  • 1 — Success.
  • 0 — Failure.

 

1

statusmsg

string

A message of success or a reason for failure.

The function returns this value in the result hash.

  • A success message.
  • An error message.
Bandwidth Limit for username has been set to unlimited megabytes