Delete VPS

Use the Delete VPS API to delete a virtual private server present on your server, by passing the ID of the VPS. The API response consists of “done” parameter which is “true” if the VPS is deleted successfully.

HTTP Request

https://hostname:4085/index.php?act=vs&delete=VPSID

Parameters

NameMethodValueDescriptionRequired
actGETvsThe action specified to the perform the operation and will return “done” as “true” if vps is deleted successfullyYes
deletePOSTIntThe ID of the vps that needs to be deletedYes

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

    $vid = 3438;

    $output = $admin->delete_vs($vid);

    print_r(json_encode($output));

?>

Output

{
  "title": "Virtual Servers",
  "done": true,
  "vs": null,
  "ostemplates": null,
  "servers": [
    {
      "serid": 0,
      "sgid": "0",
      "server_name": "localhost",
      "virt": "kvm",
      "ip": "127.0.0.1",
      "internal_ip": "",
      "vnc_ip": "192.168.1.240",
      "settings": "a:35:{s:12:\"email_update\";i:1;s:17:\"novnc_server_name\";i:0;s:6:\"cpu_nm\";i:1;s:10:\"soft_email\";s:19:\"samplemail@virtualizor.com\";s:8:\"timezone\";s:1:\"0\";s:9:\"interface\";s:0:\"\";s:16:\"alert_load_limit\";i:0;s:16:\"alert_disk_limit\";i:0;s:7:\"ping_ip\";s:0:\"\";s:14:\"addvs_cpu_prio\";s:0:\"\";s:13:\"addvs_io_prio\";s:0:\"\";s:14:\"addvs_io_class\";s:0:\"\";s:14:\"node_bandwidth\";i:0;s:20:\"del_slave_ostemplate\";i:0;s:19:\"openvz_suspend_load\";d:0;s:20:\"keep_orphan_template\";i:0;s:14:\"haproxy_enable\";i:0;s:21:\"haproxy_reservedports\";s:0:\"\";s:26:\"haproxy_reservedports_http\";s:6:\"80,443\";s:20:\"haproxy_allowedports\";s:0:\"\";s:17:\"speed_cap_disable\";i:0;s:15:\"disable_virttop\";i:0;s:9:\"cron_time\";s:10:\"3 11 * * *\";s:14:\"emps_cron_time\";s:14:\"46 18 6,21 * *\";s:11:\"cookie_name\";s:14:\"SIMCookies7614\";s:8:\"vpslimit\";s:0:\"\";s:10:\"overcommit\";i:0;s:6:\"vnc_ip\";s:13:\"192.168.1.240\";s:15:\"change_ssh_port\";i:0;s:13:\"max_ssh_login\";i:0;s:6:\"vcores\";i:0;s:17:\"disable_nw_config\";i:0;s:15:\"haproxy_src_ips\";s:14:\"103.205.175.18\";s:15:\"server_latitude\";d:0;s:16:\"server_longitude\";d:0;}",
      "unique_txt": "",
      "lv": "",
      "hvm": "0",
      "licnumvs": "0",
      "total_ram": "1989",
      "overcommit": 0,
      "ram": "1153",
      "total_space": "18",
      "space": "6",
      "os": "CentOS release 6.10 (Final)",
      "os_arch": "x86_64",
      "uname": "Linux alibaba.com 2.6.32-754.2.1.el6.x86_64 #1 SMP Fri Jul 13 12:50:12 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux",
      "version": "2.9.7",
      "patch": "0",
      "lic_expires": "30/09/2018 GMT",
      "checked": "1534799049",
      "locked": "0",
      "vcores": "7",
      "ips": "251",
      "ipv6": "0",
      "ipv6_subnet": "0",
      "ips_int": "0",
      "bandwidth": "0",
      "update_resource": "0",
      "location": "",
      "status": "1",
      "last_reverse_sync": "0",
      "numvps": "4",
      "alloc_ram": "1408",
      "alloc_space": "10",
      "alloc_cpu": "4000",
      "alloc_cpu_percent": "100.00",
      "alloc_bandwidth": "3",
      "virts": [
        "kvm"
      ]
    }
  ],
  "status": null,
  "network_status": null,
  "owners": null,
  "plans": null,
  "backup_plans": null,
  "actid": "273",
  "timenow": 1534799954,
  "time_taken": "0.231"
}
Was this helpful to you?