API Add Servers Group

From Virtualizor Wiki
Jump to: navigation, search

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

<?php

    require_once('admin.php');

    $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);
	
    print_r($output);
?>

Returns:

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