cPanel/WHM JSON API

Navigation:  Limits > Integration Components >

cPanel/WHM JSON API

Previous pageReturn to chapter overviewNext page

CloudLinux offers JSON API for lvectl via WHM. You can access it using the following URL:

 

https:/IP:2087/cpsess_YOURTOKEN/cgi/CloudLinux.cgi?cgiaction=jsonhandler&handler=list

 

The output will look as follows:

 

{"data":[{"ID":"default","CPU":"30","NCPU":"1","PMEM":"1024M","VMEM":"1024M","EP":"28","NPROC":"0","IO":"2048"}]}

 

Parameters

 

cgiaction        always jsonhandler

handler        should match lvectl command

 

For commands like set, destroy & delete, where you need to specify LVE (user) ID, like lveid=500 (matches user ID 500).

 

Example:

 

https://IP:2087/cpsess_YOURTOKEN/cgi/CloudLinux.cgi?cgiaction=jsonhandler&handler=set&lveid=500&cpu=30&io=2048

 

Output:

 

{"status":"OK"}

 

To do 'set default', use lveid=0, like:

 

https://IP:2087/cpsess_YOURTOKEN/cgi/CloudLinux.cgi?cgiaction=jsonhandler&handler=set&lveid=0&cpu=30&io=2048

 

For commands like apply all, destroy all, use:

 

handler=apply-all

handler=destroy-all

 

You can use the following commands that allow to specify user name instead of user ID:

 

set-user

Set parameters for a LVE and/or create a LVE using username instead of ID.

list-user

List loaded LVEs, display username instead of user ID.

delete-user

Delete LVE and set configuration for that user to defaults.

 

If the limits for users are set with cPanel LVE Extension, then turnkey billing solutions can be applied (e.g. WHMCS).