Delete Recipe

Use the Delete Recipe API to delete a recipe from the Virtualizor panel, by passing recipe ID to the API. For deleting multiple recipes you need to pass the recipe IDs as comma separated values. The API response will contain “done” as the array of the IDs of the deleted recipes on success.

HTTP Request

https://hostname:4085/index.php?act=recipes

Parameters

NameMethodValueDescriptionRequired
actGETrecipesThe action specified to perform the operation and will return “done” as the array of the deleted IDs of recipes on successYes
deletePOSTIntThe recipe ID that needs to be deleted. For deleting multiple recipes pass in the IDs as comma separated valuesYes

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

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

    print_r(json_encode($output));
?>

Output

{
    "title": "Recipes",
    "done": ["19"],
    "recipe": {
        "9": {
            "rid": "9",
            "name": "test287",
            "code": "#!\/bin\/sh\n\ntouch \/newtest",
            "desc": "Just testing yar",
            "logo": "",
            "status": "1"
        },
        "13": {
            "rid": "13",
            "name": "test",
            "code": "#!\/bin\/sh\necho \"Europe\/Budapest\" > \/etc\/localtime",
            "desc": "",
            "logo": "",
            "status": "1"
        },
        "16": {
            "rid": "16",
            "name": "test279",
            "code": "#!\/bin\/sh\necho \"recepi\" > \/test.txt",
            "desc": "Just testing yar\r\n softaculous.com",
            "logo": "https:\/\/hostname:4085\/sessbpxbng7dzqjuykqr\/themes\/default\/images\/loginlogo.gif",
            "status": "1"
        },
        "17": {
            "rid": "17",
            "name": "Recipe01",
            "code": "#!\/bin\/sh\necho `date` >> \/root\/abhi1.txt\n",
            "desc": "",
            "logo": "",
            "status": "1"
        },
        "18": {
            "rid": "18",
            "name": "WinRecipe1",
            "code": "#!\/bin\/sh\necho date c:\\\\abhi1.txt",
            "desc": "",
            "logo": "",
            "status": "1"
        },
        "19": {
            "rid": "19",
            "name": "test_recipe1",
            "code": "#!\/bin\/sh\nThis is your test recipe",
            "desc": "This is the description for test recipe",
            "logo": "",
            "status": "1"
        }
    },
    "timenow": "1477375332",
    "time_taken": "0.076"
}
Was this helpful to you?