HTTP Request
https://hostname:4085/index.php?act=volumes
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | volumes | The action specified carries out operation and returns success if the volumes has been added successfully | Yes |
addvolume | POST | addvolume | Pass 1 to addvolume | Yes |
disk_name | POST | name | Name of the Volume | Yes |
newserid | POST | serid | Server ID of vps for which volume is to be created | Yes |
vpsid | POST | int | vpsid for which volume is to be created | Yes |
size | POST | float | size of volume in GBs | Yes |
format_type | POST | text | Format type of volume ext4 or xfs | Yes |
attach | POST | 1/0 | To attach volume to vps pass 1 or 0 to create only | Yes |
mnt_point | POST | text | Mountpoint to mount inside vps if you want to attach and mount | No |
st_uuid | POST | int | Storage uuid, If not passed Primary storage will be used | 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['addvolume'] = '1';
$post['disk_name'] = 'second';
$post['vpsid'] = '12115';
$post['newserid'] = 4;
$post['size'] = 1.5;
$post['attach'] = 1;
$post['format_type'] = 'ext4';
$post['mnt_point'] = '/mnt/sec';
$post['st_uuid'] = 'c3yq8jr9wbdskqz1';
$output = $admin->add_volumes($post);
print_r($output);
Output
Array
(
["done"] => Array
(
["voladd_done"] => 1
)
)