Use the Edit Server group API to update the server groups information. The API response will contain "done" as "1" after successful update of the server groups.
These Server groups allow you to differentiate between multiple servers which can be very useful during the billing process. For example, Lets say you have 10 Servers in the USA and 5 in Europe. You can create two groups which can be used in the Billing Module for creating seperate orders.
For more information, please refer this Server Groups guide.
HTTP Request
https://hostname:4085/index.php?act=editsg&sgid=SGID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | editsg | The action will perform the operation and will "done" as "1" on successful update of the servergroup | Yes |
sgid | GET | Int | The server group ID which needs to be edited | Yes |
sg_name | POST | text | Server Group Name | Yes |
sg_reseller_name | POST | text | The name that will be shown to resellers (Optional) | No |
sg_desc | POST | text | Description of the Group | No |
sg_select | POST | 1/0 | Server Selection (0 for Least Utilized and 1 for First Available) | No |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$post = array();
$post['editsg'] = 1;
$post['sgid'] = 1;
$post['sg_name'] = 'Test Group';
$post['sg_reseller_name'] = 'Test Reseller Name';
$output = $admin->editsg($post);
print_r(json_encode($output));
?>
Output
{
"title": "Edit Server Group / Region",
"done": 1,
"servergroup": {
"sgid": "1",
"sg_name": "Test Group",
"sg_reseller_name": "Test Reseller Name",
"sg_desc": "",
"sg_select": "0"
},
"timenow": 1535487536,
"time_taken": "0.220"
}