Delete Media Group

Use the Delete Media Group API to delete media group(s) present on the Virtualizor panel. The API response will contain “done” as array of deleted media group IDs.

HTTP Request

https://hostname:4085/index.php?act=mediagroups&delete=MGID

Parameters

NameMethodValueDescriptionRequired
actGETmediagroupsThe action will return the done as the array of deleted media group IDsYes
deletePOSTComma Separated ValuesThe media group IDs that needs to be deletedYes

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['delete'] = 1; 
    $post['delete'] = '1,2'; // for deleting multiple values

    $output = $admin->delete_mg($post);     

    print_r(json_encode($output));
?>

Output

{
    "title": "Media Groups",
    "done": [
        1,
        2
    ],
    "mediagroups": null,
    "timenow": 1536089821,
    "time_taken": "0.289"
}
Was this helpful to you?