|
|||
|
Looking up cPanel API call parameters
So, I'm not sure if I posted this here previous or not, but I have a nifty little dumper CustomEventHandler I wrote that logs all cPanel API calls made to the error_log. This means that you can see what parameters it was called with which is very handy if you need information on how API1/API2 calls are made (for theme development, etc).
This will only print returned data for API2 calls, API1 calls print data rather than return so it is rather difficult to do this. Installation: wget sdk.cpanel.net/utils/CustomEventHandler-Dumper.tar.gz tar vzxf CustomEventHandler-Dumper.tar.gz cp CustomEventHandler-Dumper/CustomEventHandler.pm /usr/local/cpanel/Cpanel cp CustomEventHandler-Dumper/Dumper.pm /usr/local/cpanel/perl/Data tail -f /usr/local/cpanel/logs/error_log and hit something in the interface. NOTE: this shold never by run on a production server, thigns like password of new email/ftp/whatever accounts will be logged to the error_log with this enabled NOTE: if you wish to filter to look for calls within a specific module, please check out the commented line within the event function of CustomEventHandler.pm When you hit an API call in cPanel (which you will several times for every page): statsbar:stat $apiv = 2 $type = post ----- $cfgref $VAR1 = { 'rowcounter' => 'mainstats', 'infinitylang' => 'true', 'display' => 'diskusage|bandwidthusage' }; ----- $dataref $VAR1 = [ { 'percent10' => 0, 'normalized' => 1, 'rowtype' => 'even', 'percent20' => 0, 'item' => 'Monthly Bandwidth Transfer', 'zeroisunlimited' => 1, 'name' => 'bandwidthusage', '_maxed' => 1, '_count' => 0, 'units' => 'MB', 'percent' => 0, '_max' => 'unlimited', 'count' => 0, 'max' => '∞ MB', 'percent5' => 0, 'langkey' => 'INDXBandwidth', 'module' => 'Stats', 'feature' => 'bandwidth', 'id' => 'bandwidthusage' }, { 'percent10' => 0, 'normalized' => 1, 'percent5' => 0, 'rowtype' => 'odd', 'percent20' => 0, 'item' => 'Disk Space Usage', 'zeroisunlimited' => 1, 'name' => 'diskusage', 'langkey' => 'INDXDiskUsage', '_maxed' => 0, '_count' => '1.32', 'units' => 'MB', 'module' => 'Quota', '_max' => 1000, 'percent' => 0, 'count' => '1.32', 'max' => '1000 MB', 'id' => 'diskusage' } ]; Last edited by cPanelMatt; 09-09-2009 at 10:08 AM. |
|
|||
|
This has been updated to log API1 parameters as well.
This now relies on /dev/shm being accessible, so please remember, development servers ONLY. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| API Call Safe? | hostb | Developer Discussions | 6 | 09-17-2009 11:25 AM |
| API : call to change owner? | BartVenken | Developer Discussions | 4 | 11-26-2008 03:10 AM |
| Cpanel call of duty 2 | btstyle | cPGS Discussions | 1 | 08-11-2008 10:56 AM |
| API call to change cpanel password? | electric | cPanel and WHM Discussions | 16 | 07-27-2007 08:58 AM |
| mod_security question - Anyway to call exec WITH parameters? | jols | cPanel and WHM Discussions | 0 | 03-11-2007 12:25 AM |