[SOLVED] Disable storage by API

fleahole

New Member
Feb 2, 2022
2
0
1
45
Hi,

I now tried for two days to disable a storage over the API but I can't make it work. Same as "pvesm set STORAGE --disable 1" would do.

My best guess is:
https://NODEIP:8006/api2/json/storage/STORAGENAME --data disable=1 --insecure --cookie PVEAuthCookie=COOKIE --header CSRFPreventionToken:TOKEN -X PUT

The token generation and permissions are okay. The scripts works for me for shutdown over the API (with different URL, permissions and POST of course).

Could somebody please give me a hint? Are there any logs I could check?

Thanks!
 
Last edited:
This looks like you are using curl. You could run it with the additional parameter -i to check the HTTP return code.

If I try to do that with a user/token that does not have those permissions, I get the following return:
Code:
HTTP/1.1 403 Permission check failed (/storage, Datastore.Allocate)
 
I also got the 403 error back. I then checked all permissions and noticed that I had the path /storage/STORAGENAME instead of just /storage.
After changing this, it now works!

Thank you very much for the hints!!
 

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!