API Add Servers Group

From Virtualizor Wiki
Jump to: navigation, search
This is OLD API Documentation. Click on the following link for New API Documentation
Admin API

Add Server Group

Parameters Type Description
addsg POST Flag to add Server Group
sg_name POST Server Group Name
sg_reseller_name POST The name that will be shown to resellers (Optional)
sg_desc POST Description of the Group
sg_select. POST Server Selection (0 for Least Utilized and 1 for First Available)

Example Code



    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

    $ip = 'xxx.xxx.xxx.xxx';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['addsg'] = 1;
    $post['sg_name'] = 'testapi';
    $post['sg_reseller_name'] = 'testapi';
    $post['sg_desc'] = 'testapi';
    $post['sg_select'] = 0;

    $output = $admin->addsg($post);

Returns: <syntaxhighlight lang="php"> Array (

   [title] => Add Server Group
   [done] => 1
   [error] => 
   [timenow] => 1430983212
   [time_taken] => 0.056