API Edit Server

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

Edit Server

Parameters Description
server_name New server name
ip Ip of the server
pass API pass of the server
sgid The server group id
serid Server id

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['server_name'] = '0dot114';
    $post['ip']			 = '37.59.0.114';
    $post['pass']		 = 'zmoe16mir42b0e01htjjcwq0unfb7335';
    $post['sgid'] 		 = '0';
    $post['serid']		 = '1';
    $output = $admin->editserver($post);
    print_r($output);
?>

Returns:

Array
(
    [title] => Edit Server
    [saved] => 1
    [ipblocks] => 
    [serid] => 1
    [serv] => Array
        (
            [serid] => 1
            [sgid] => 0
            [server_name] => 0dot114
            [virt] => xen
            [ip] => 37.59.0.114
            [lv] => 
            [hvm] => 1
            [licnumvs] => 0
            [total_ram] => 16293
            [overcommit] => 0
            [ram] => 13277
            [total_space] => 1664
            [space] => 1653
            [checked] => 1403079519
            [numvps] => 2
            [alloc_ram] => 2048
            [alloc_space] => 10
            [alloc_cpu] => 1256
            [alloc_cpu_percent] => 100.00
            [alloc_bandwidth] => 0
        )

    [servergroups] => Array
        (
            [0] => Array
                (
                    [sgid] => 0
                    [sg_name] => Default
                    [sg_desc] => Default Group
                    [sg_select] => 0
                )

            [2] => Array
                (
                    [sgid] => 2
                    [sg_name] => Group 1 [ US East ]
                    [sg_desc] => Group 1 [ US East ] description
                    [sg_select] => 0
                )

        )

    [timenow] => 1403079932
    [time_taken] => 0.115
)