Deleting backups via api - Unexpected Content error

Daxcor

Member
Oct 31, 2021
45
2
13
58
I am trying to delete backups for a specific vmid. here is the code:

Code:
curl --location --request DELETE 'http://pve0.mgmt.local:8006/api2/json/nodes/pve0/storage/tempbackup/prunebackups' \
--header 'Authorization: PVEAPIToken=api@pve!apiToken=redacted' \
--header 'Content-Type: application/json' \
--data '{
    "vmid": 4000
}'

When I run this with out the data, it completes successfully but doesn't delete any backups. What am I doing wro
 
The DELETE doesn't expect a request body. That's why the command works without the data portion.
Encode the required parameter within the url instead.
Bash:
curl --location --request DELETE \
  'http://pve0.mgmt.local:8006/api2/json/nodes/pve0/storage/tempbackup/prunebackups?vmid=4000' \
  --header 'Authorization: PVEAPIToken=api@pve!apiToken=redacted'
 
  • Like
Reactions: Daxcor