Delete group via api

zmen

Active Member
Nov 28, 2018
1
0
41
37
Hello.
Try to delete a group from datastore via api like:
1. curl -X DELETE https://x.x.x.x:8007/api2/json/admin/datastore/storename/groups/vm/666 -b PBSAuthCookie=xxxx
2. curl -X DELETE https://x.x.x.x:8007/api2/json/admin/datastore/storename/groups -b PBSAuthCookie=xxxx --header 'Content-Type: application/json' --data '{"data":[{"backup-id": "666","backup-type":"vm",}]}'
3. curl -X DELETE https://x.x.x.x:8007/api2/json/admin/datastore/storename/vm/666 -b PBSAuthCookie=xxxx
4. curl -X DELETE https://x.x.x.x:8007/api2/json/admin/datastore/storename/groups?backup-type=vm&backup-id=666 -b PBSAuthCookie=xxxx

All wrong. Can any one help me with it ?
 
the url would have to be
Code:
/api2/json/admin/datastore/STORENAME/groups?backup-type=TYPE&backup-id=ID&ns=NAMESPACE
as DELETE (as you correctly identified)

whats probably missing is the CSRFPrevention token that you get with the ticket calls, this is necessary for all non-GET operations

if you want to see a complete api call that works, check the browser debug console when deleting a group, in chrome you can even use the 'copy as curl' feature to get
a complete curl commandline for a specific request