Use Add Volume API to create new volume on your server.
This function is for cloud user
Parameters
Parameters | Type | Value | Description |
---|---|---|---|
act | GET | volume | The action will create volume for a particular vps and user |
volname | POST | text | Specify the name of the volume to be created. |
vps_sel | POST | Int | Vpsid for which volume is to be created. |
vol_size | POST | int | Size of the volume that is to be created. |
format | POST | text | Format for volume ext4 or xfs. |
attach_vol | POST | Int | pass 1 to create and attach and 0 to just create it. |
mntpoint | POST | text | Mountpoint to mount volume inside vps |
PHP
<?php
require_once('/usr/local/virtualizor/sdk/enduser.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'host_ip';
$admin = new Virtualizor_Enduser_API($ip, $key, $pass);
$post = array();
$post['vol_size'] = '2';
$post['vps_sel'] = '143';
$post['format'] = 'ext4';
$post['attach_vol'] = '1';
$post['mntpoint'] = '/mnt';
$post['volname'] = 'enduer';
$output = $admin->add_volume($post);
print_r(json_encode($output));
?>