Deleting vm via Api not working

jort

New Member
Nov 24, 2016
19
0
1
26
i am trying to delete a VM via the api using

DELETE api2/json/node/<node>/qemu/<vmid>

the command returns {data:null} and nothing else, and the vm just stays there the only way to delete it is via the GUI and having to enter a confirm so maybe that has to do something with it?

-thanks
 

im using this function

this.del = function(url, data, header, cookie) {
command = 'curl -X DELETE -k '
if (typeof cookie === 'string') command += ('-b '+ 'PVEAuthCookie='+ cookie + ' ');
if (typeof header === 'string') command += ('-H ' +'"'+'CSRFPreventionToken:' + header + '"'+' ');
command += (' ' + apiURL + url);
return this;

and then using curl on the command, were header is the preventiontoken. it works fine on deleting users but it doesnt want to delete VM's
 
i tested it, and it works fine here...

i only get {"data":null} if i choose a wrong nodename or vmid

are you sure the url is correct?
 
i tested it, and it works fine here...

i only get {"data":null} if i choose a wrong nodename or vmid

are you sure the url is correct?

checked it, aaaaaand it wasnt, i was creating my url using api2/json/node/[node]/qemu[vmid] so i was missing the / between the qemu and vmid. thanks for pointing it out before i started ripping and rewriting all my code.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!