Get Virtualizor

Add Recipes

Use the Add Recipes API to add a recipe to the Virtualizor panel. Recipes are predefined bash scripts that are created by admin for endusers. Only the activated recipes are visible to the enduser. These recipes can be executed on the VPS during their creation. Recipes can also be applied while the VPS is running, however you need to stop then start the VPS for the execution of the recipe to take place. The API response will contain "done" as "1" if the recipe has been added successfully. Newly added recipes are active by default and are visible to the enduser.

HTTP Request



actGETaddrecipeThe action will return done as 1Yes
recipe_namePOSTtextName of the recipeYes
recipe_scriptPOSTtextRecipe script to be executedYes
descPOSTtextDescription given to the recipeNo
recipe_logoPOSTtextThe logo url for the recipeNo
shellPOSTtextProvide the shell type using which the recipe should be executed (Since 3.1.3 version)

Valid shell types (Since v3.1.3)

Value Description
Default(sh shell) #!/bin/sh
Bash #!/bin/bash
Ksh #!/bin/ksh
Zsh #!/bin/zsh

Custom shells can be added in /usr/local/virtualizor/globals.php file append values in array variable globals['shells'].

$globals['shells'] = array('python' => '#!/usr/bin/python');

Sample Code



    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['recipe_name'] = 'test recipe';
    $post['recipe_logo'] = '';
    $post['recipe_script'] = 'echo "This is your test recipe" ';
    $post['desc'] = 'This is the description for test recipe';
$post['shell'] = 'Bash'; $output = $admin->add_recipes($post); print_r(json_encode($output)); ?>


    "title": "Add Recipe",
    "done": 7, //Recipe ID
    "done_msg": "The Recipe has been added",
    "timenow": 1536152422,
    "time_taken": "0.219"
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list