[SOLVED] Disable storage by API

fleahole

New Member
Feb 2, 2022
2
0
1
46
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!!