Use the Edit Server API to edit the server settings. For master server then only the internal IP address and "Lock Server" configurations can be edited. For slave server the server's name, IP address, API password, "Lock Server", servergroup and internal IP address can be edited. If the server is "Locked" no new VPS will be created on it.
The API response will contain "saved" as "true" after successful update of the server details.
See also : Server Clustering.
HTTP Request
https://hostname:4085/index.php?act=editserver&serid=SERID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | editserver | The action to edit the server in a cluster | Yes |
serid | GET | Int | The ID of the server which needs to be edited | Yes |
server_name | POST | text | The server name | Yes |
ip | POST | text | IP address of the server | Yes |
pass | POST | text | The API password of the server | No |
sgid | POST | Int | The server group ID | No |
locked | POST | (1 = for locking) / (Do not pass this variable to unlock the server) | The flag value to decide whether the will be locked or not | No |
internal_ip | POST | text | The internal ip will be assigned to the server | 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['server_name'] = 'Slave_server';
$post['ip'] = 'slave_ip';
$post['pass'] = 'slave_api_pass';
$post['sgid'] = 0;
$post['serid'] = 1;
$output = $admin->editserver($post);
print_r(json_encode($output));
?>
Output
{
"title": "Edit Server",
"saved": true,
"ipblocks": null,
"serid": 1,
"serv": {
"serid": "1",
"sgid": "0",
"server_name": "Slave_server",
"virt": "kvm",
"ip": "192.168.1.247",
"internal_ip": "",
"vnc_ip": "",
"settings": null,
"unique_txt": "",
"lv": "",
"hvm": "0",
"licnumvs": "0",
"total_ram": "976",
"overcommit": "0",
"ram": "542",
"total_space": "34",
"space": "20",
"os": "CentOS Linux release 7.3.1611 (Core)",
"os_arch": "x86_64",
"uname": "Linux localhost.localdomain 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux",
"version": "2.9.7",
"patch": "0",
"lic_expires": "10/08/2018 GMT",
"checked": "1537447726",
"locked": "0",
"vcores": "0",
"ips": "0",
"ipv6": "0",
"ipv6_subnet": "0",
"ips_int": "0",
"bandwidth": "0",
"update_resource": "0",
"location": "",
"status": "1",
"last_reverse_sync": "1537448208",
"virts": [
"kvm"
]
},
"servergroups": {
"0": {
"sgid": 0,
"sg_name": "Default",
"sg_reseller_name": "Default",
"sg_desc": "Default Group",
"sg_select": 0
},
"2": {
"sgid": "2",
"sg_name": "test_sg",
"sg_reseller_name": "US",
"sg_desc": "This is just test",
"sg_select": "0"
}
},
"timenow": 1537448594,
"time_taken": "0.352"
}