Deleting vm via Api not working

jort

New Member
Nov 24, 2016
19
0
1
27
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.