Get Virtualizor

List Recipes

This page is under progr

Use the List Recipes API to list all the recipes added by the admin. 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 contains the list of the recipe information, which are listed according to their ID. To filter or limit the size of the list you can pass in one or more query parameters.

HTTP Request

https://hostname:4085/index.php?act=recipes&rid=RID&rname=RNAME&page=PAGE&reslen=RESLEN

Parameters


Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/enduser.php');

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

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

    $page = 1;
    $reslen = 10;

    $output = $admin->list_recipes($page,$reslen);

    print_r(json_encode($output));

?>

Output

{
    "title": "Recipes",
    "recipe": {
        "1": {
            "rid": "1",
            "name": "hello",
            "code": "#!/bin/sh\ndate >> /root/date.txt;\n",
            "desc": "",
            "logo": "",
            "status": "1"
        },
        "2": {
            "rid": "2",
            "name": "api recipe",
            "code": "#!/bin/sh\ndate > /tmp/recipe.txt\n\t",
            "desc": "This is the description for test recipe",
            "logo": "",
            "status": "1"
        },
        "3": {
            "rid": "3",
            "name": "test_recipe edit 2",
            "code": "#!/bin/sh\necho \"This is your test recipe edit\" >> /tmp/recipe_edit.txt",
            "desc": "",
            "logo": "",
            "status": "1"
        }
    },
    "timenow": 1536159274,
    "time_taken": "0.206"
}

Use the List Recipes API to list all the recipes added by the admin. 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 contains the list of the recipe information, which are listed according to their ID. To filter or limit the size of the list you can pass in one or more query parameters.

HTTP Request

https://hostname:4085/index.php?act=recipes&rid=RID&rname=RNAME&page=PAGE&reslen=RESLEN

Parameters

NameMethodValueDescriptionRequired
actGETrecipesThe action will return the vpsYes
reslenGETIntNumber of records to be returned, default is 50No
pageGETIntPage number, each page show 50 recordsNo
ridGETIntThe recipes are searched on the basis of the recipe IDNo
rnameGETtextThe recipes are searched on the basis of the recipe nameNo

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);

    $page = 1;
    $reslen = 10;
    $post = array();    
    $post['rid'] = '';
    $post['rname'] = 'test_recipe*';

    $output = $admin->list_recipes($page,$reslen);

    print_r(json_encode($output));

?>

Output

{
    "title": "Recipes",
    "recipe": {
        "1": {
            "rid": "1",
            "name": "hello",
            "code": "#!/bin/sh\ndate >> /root/date.txt;\n",
            "desc": "",
            "logo": "",
            "status": "1"
        },
        "2": {
            "rid": "2",
            "name": "api recipe",
            "code": "#!/bin/sh\ndate > /tmp/recipe.txt\n\t",
            "desc": "This is the description for test recipe",
            "logo": "",
            "status": "1"
        },
        "3": {
            "rid": "3",
            "name": "test_recipe edit 2",
            "code": "#!/bin/sh\necho \"This is your test recipe edit\" >> /tmp/recipe_edit.txt",
            "desc": "",
            "logo": "",
            "status": "1"
        }
    },
    "timenow": 1536159274,
    "time_taken": "0.206"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list