Use the Deactivate Recipe API to deactivate recipes. Recipes are predefined bash scripts that are created by admin for endusers. Deactivated recipes will not be visible to the enduser. The API response will contain "done" as the array of the IDs of the recipes that have been successfully activated.
HTTP Request
https://hostname:4085/index.php?act=recipes
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | recipes | The action will return a list of recipes after the deactivating the specified recipe | Yes |
deactivate | POST | Int | The ID of the recipe that needs to be deactivated. For deactivating multiple recipes pass in the IDs as comma separated values | 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['deactivate'] = 7;
$post['deactivate'] = '7,8,9'; // for deactivating multiple recipes
$output = $admin->recipes($post);
print_r(json_encode($output));
?>
Output
{
"title": "Recipes",
"done": [
7,
8,
9
],
"recipe": {
"7": {
"rid": "7",
"name": "api recipe 2",
"code": "#!/bin/sh\n",
"desc": "",
"logo": "",
"status": "1"
},
"8": {
"rid": "8",
"name": "api recipe 3",
"code": "#!/bin/sh\n",
"desc": "",
"logo": "",
"status": "1"
},
"9": {
"rid": "9",
"name": "api recipe 4",
"code": "#!/bin/sh\n",
"desc": "",
"logo": "",
"status": "1"
}
},
"timenow": 1536162598,
"time_taken": "0.256"
}