Child pages
  • WHM API 1 Functions - limitbw
Skip to end of metadata
Go to start of metadata

 

Description

This function modifies a cPanel account's bandwidth quota.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/limitbw?api.version=1&user=username&bwlimit=0
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/limitbw?api.version=1&user=username&bwlimit=0
 Command Line
whmapi1 limitbw user=username bwlimit=0


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{  
   "data":{  
      "bwlimits":[  
         {  
            "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"
         }
      ]
   },
   "metadata":{  
      "version":1,
      "reason":"Bandwidth Limit for username has been set to unlimited megabytes",
      "result":1,
      "command":"limitbw"
   }
}
 Output (XML)
<result>
    <data>
        <bwlimits>
            <unlimited>1</unlimited>
            <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>
        </bwlimits>
    </data>
    <metadata>
        <version>1</version>
        <reason>
            Bandwidth Limit for username has been set to unlimited megabytes
        </reason>
        <result>1</result>
        <command>limitbw</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

   

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

bwlimits

array of hashes

An array of hashes of account information.

Each hash contains 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 array.

  • 1 — Unlimited.
  • 0 — Not unlimited.
1

bwlimit

integer

The account's new bandwidth quota.

The function returns this value in the bwlimit array.

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

bwlimitenable

Boolean

Whether bandwidth limiting is enabled for the account.

The function returns this value in the bwlimit array.

  • 1 — Enabled.
  • 0 — Disabled.
0

domains

array

An array of the account's domains.

The function returns this array in the bwlimit array.

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 array.

  • unlimited — The user has 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 array.

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