Use the Add Media Groups API to create a media groups on the server. Media groups allow the admin to manage the ISOs / OS templates which are used for creating Virtual Private Servers. You can group multiple ISOs in a single media group and assign that media group to particular enduser, ensuring that the enduser has access to only those ISOs for creating Virtual Private Servers. The API response will contain "done" as "true" on successful creation of the media group.
HTTP Request
https://hostname:4085/index.php?act=addmg
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | addmg | The action specified to perform operation will return "done" as "true" on success | Yes |
mg_name | POST | text | Name for the media group | Yes |
mg_desc | POST | text | The description of the media group | Yes |
mg_type | POST | text | Type of media group | Yes |
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['mg_name'] = 'testing for api';
$post['mg_desc'] = 'Testing for the api';
$post['mg_type'] = 'kvm';
$output = $admin->addmg($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add Media Group",
"done": true,
"timenow": 1536088189,
"time_taken": "0.213"
}