Get Virtualizor

Show Tasks

Use the Show Tasks API to show the tasks information about all the activity that has been performed on the server by Virtualizor. You can monitor operations like creation of VPS, rebuilding of the VPS, backing up of VPS, restoration of VPS, installation of recipes, installation of control panel etc. for complete list of operations that you can monitor, please refer below table. The API response contains the list of the information of the task, which are listed according to their "actid".

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETtasksThe action specified to perform operation and retrieve dataYes

Action

ValuesDescription
addvsCreating VPS
addvs_restoreCreating VPS for Restore
rebuildvsRebuilding VPS
vpsbackupsBacking up VPS
restorevpsRestoring VPS
migrate2Migrating VPS
multimigrateprogMultiple Migrate
clone2Cloning VPS
multicloneprogMultiple Clone
deletevsDeleting VPS
createtemplateCreating Template
fstab_handleFS Tab Handle
editxcpvsEdit XCP VPS
resizevpsResizing VPS
multivirtEnabling Multivirt
getosDownloading OS
change_dnsnameserverChanging DNS Nameserver
changepasswordChanging VPS Password
install_cpInstall Control panel
hostnameChanging VPS Hostname
install_recipeInstall Recipe
bandwidth_unsuspendUnsuspend Bandwidth
suspend_callbackSuspend Callback
unsuspend_callbackUnsuspend Callback
editvps_callbackEdit VPS Callback
terminate_callbackTerminate VPS Callback
get_crtLets Encrypt Install Certificate
renew_crtLets Encrypt Renew Certificate
cron_crtLets Encrypt Renew Certificate Cron Task
haproxy_cronHAProxy Rebuild
vpsbackups_planVPS Backups
restorevps_planVPS Restore
addsshkeysAdding SSH Keys
installxentoolsInstalling Xenserver Tools
dbbackupsDatabase Backup
install_scriptInstalling Apps

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

    $output = $admin->tasks();

    print_r(json_encode($output));

?>

Output

{
    "title": "Tasks List",
    "tasks": {
        "484": {
            "actid": "484",
            "slaveactid": "0",
            "uid": "0",
            "vpsid": "0",
            "serid": 0,
            "action": "getos",
            "data": "a:1:{s:2:\"os\";a:1:{i:0;a:5:{s:4:\"osid\";i:100008;s:10:\"inprogress\";i:0;s:4:\"done\";i:1;s:6:\"failed\";i:0;s:7:\"err_msg\";s:19:\"Download successful\";}}}",
            "time": "1536081131",
            "status_txt": "Task Completed",
            "status": "1",
            "progress": "100",
            "started": "September 4, 2018, 5:12 pm",
            "updated": "September 4, 2018, 5:13 pm",
            "ended": "September 4, 2018, 5:13 pm",
            "proc_id": "0",
            "ip": "192.168.1.188",
            "internal": "0",
            "email": "root",
            "os": [
                {
                    "osid": 100008,
                    "inprogress": 0,
                    "done": 1,
                    "failed": 0,
                    "err_msg": "Download successful"
                }
            ],
            "server_name": "localhost",
            "action_txt": "Downloading OS"
        },
        "483": {
            "actid": "483",
            "slaveactid": "0",
            "uid": "0",
            "vpsid": "0",
            "serid": 0,
            "action": "getos",
            "data": "a:1:{s:2:\"os\";a:1:{i:0;a:5:{s:4:\"osid\";i:100008;s:10:\"inprogress\";i:0;s:4:\"done\";i:1;s:6:\"failed\";i:0;s:7:\"err_msg\";s:19:\"Download successful\";}}}",
            "time": "1536079172",
            "status_txt": "Task Completed",
            "status": "1",
            "progress": "100",
            "started": "September 4, 2018, 4:39 pm",
            "updated": "September 4, 2018, 4:40 pm",
            "ended": "September 4, 2018, 4:40 pm",
            "proc_id": "0",
            "ip": "192.168.1.188",
            "internal": "0",
            "email": "root",
            "os": [
                {
                    "osid": 100008,
                    "inprogress": 0,
                    "done": 1,
                    "failed": 0,
                    "err_msg": "Download successful"
                }
            ],
            "server_name": "localhost",
            "action_txt": "Downloading OS"
        }
    },
    "logs_data": null,
    "l_common_logs": "The logs shown are the last operation performed for this task by virtualizor",
    "timenow": 1536144695,
    "time_taken": "0.361"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list