This article provides a guide for a VPS Reseller user to delete VM via API.
Use Delete VM API to delete your VPS from your server.
This function is for cloud users.
HTTP Request
https://vm1.apivps.com:4083/index.php?act=listvs&delvs=vpsid
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | listvs | Retrieves the list of vps created | Yes |
delvs | POST | vpsid | The vpsid that needs to be deleted | Yes |
Sample Code
PHP
<?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); $del_vpsid = 3589; $output = $admin->listvs($del_vpsid); print_r(json_encode($output)); ?>
Curl
curl -k -X GET -L "https://vm1.apivps.com:4083/index.php?act=listvs&delvs=9999&api=json&apikey=your_api_pass&apipass=your_api_pass"
Output
{ "uid": "372", "act": "listvs", "timezone": 1, "timenow": "June 6, 2023, 2:21 am", "vpsid": "9999", "username": "test@test.com", "user_type": "2", "preferences": { "fname": "test", "lname": "test", "language": "english", "theme": "default", "timezone": 1, "logo": "" }, "url": "index.php?", "rdns": { "pdnsid": "12" }, "pdns": { "pdnsid": "12" }, "support_link": "http://radwebhosting.com", "title": "Virtual Servers", "vs": { "8888": { "vpsid": "8888", "vps_name": "v8888", "uuid": "w39wbbcohi8rwz2p", "serid": "0", "time": "1475370479", "edittime": "1475799626", "virt": "kvm", "uid": "372", "plid": "0", "hostname": "testcloud8888", "osid": "955", "os_name": "centos-7.8-x86_64", "iso": "", "sec_iso": "", "boot": "cda", "space": "50", "inodes": "0", "ram": "1024", "burst": "0", "swap": "1024", "cpu": "256", "cores": "8", "cpupin": "-1", "cpu_percent": "100.00", "bandwidth": "1000", "network_speed": "128000", "upload_speed": "128000", "io": "0", "ubc": "", "acpi": "1", "apic": "1", "pae": "1", "shadow": "0", "vnc": "1", "vncport": "6285", "vnc_passwd": "", "hvm": "0", "suspended": "0", "suspend_reason": null, "nw_suspended": null, "rescue": "0", "band_suspend": "1", "tuntap": "0", "ppp": "0", "ploop": "0", "dns_nameserver": "a:0:{}", "osreinstall_limit": "0", "preferences": null, "nic_type": "default", "vif_type": "", "virtio": "1", "pv_on_hvm": "0", "kvm_cache": "0", "io_mode": "0", "cpu_mode": "default", "total_iops_sec": "0", "read_bytes_sec": "0", "write_bytes_sec": "0", "kvm_vga": "0", "acceleration": "0", "vnc_keymap": "en-us", "routing": "0", "mg": "", "used_bandwidth": "0.02", "webuzo": "0", "disable_ebtables": "0", "admin_managed": "0", "rdp": "1", "topology_sockets": "0", "topology_cores": "0", "topology_threads": "0", "mac": "", "notes": null, "disable_nw_config": "0", "email": "test@test.com", "server_name": "localhost", "os_distro": "centos", "distro": "centos_40.gif", "status": 1, "ips": { "s143228": "xx.xx.xx.xx" } }, "9999": { "vpsid": "9999", "vps_name": "v9999", "uuid": "3b2dhqrq9cjilhbq", "serid": "0", "time": "1475812986", "edittime": "0", "virt": "kvm", "uid": "372", "plid": "0", "hostname": "testcloud9999", "osid": "955", "os_name": "centos-7.8-x86_64", "iso": "", "sec_iso": "", "boot": "cda", "space": "5", "inodes": "0", "ram": "1024", "burst": "0", "swap": "1024", "cpu": "256", "cores": "8", "cpupin": "-1", "cpu_percent": "100.00", "bandwidth": "1000", "network_speed": "128000", "upload_speed": "128000", "io": "0", "ubc": "", "acpi": "1", "apic": "1", "pae": "1", "shadow": "0", "vnc": "1", "vncport": "6288", "vnc_passwd": "vncpass", "hvm": "0", "suspended": "0", "suspend_reason": null, "nw_suspended": null, "rescue": "0", "band_suspend": "1", "tuntap": "0", "ppp": "0", "ploop": "0", "dns_nameserver": "a:0:{}", "osreinstall_limit": "0", "preferences": null, "nic_type": "", "vif_type": "", "virtio": "1", "pv_on_hvm": "0", "kvm_cache": "", "io_mode": "", "cpu_mode": "", "total_iops_sec": "0", "read_bytes_sec": "0", "write_bytes_sec": "0", "kvm_vga": "0", "acceleration": "0", "vnc_keymap": "", "routing": "0", "mg": "", "used_bandwidth": "0.00", "webuzo": "0", "disable_ebtables": "0", "admin_managed": "0", "rdp": "1", "topology_sockets": "0", "topology_cores": "0", "topology_threads": "0", "mac": "", "notes": null, "disable_nw_config": "0", "email": "test@test.com", "server_name": "localhost", "os_distro": "centos", "distro": "centos_40.gif", "status": 1, "ips": { "s76463": "xx.xx.xx.xx." } } }, "info": { "flags": { "enable_idsort": 1, "show_server": 0, "novnc": 1, "disable_java_vnc": 0 } }, "done": { "msg": "The VPS delete process has been initiated", "goto": "act=listvs", "vpsid": null }, "delvs": { "done": true, "done_msg": "The VPS delete process has been initiated" }, "time_taken": "0.488" }
Conclusion
You now know how to delete VM as a VPS Reseller for use with VPS servers.