network-resurrector/solution items/notes/proxmox-shutdown-notes.txt

18 lines
1.0 KiB
Plaintext

Hi Guys
So long story short I want to shut down my physical server that is running Proxmox VE using the API. I am fairly new to using API but what I have found thus far is this:
curl https://yourip:8006/api2/json//nodes/proxmox/stop -k -d 'username=root@pam&password=yourpassword'
Above does not seem to work, Anyone able to assist and just provide the correct curl to use
Thanx
!!!!!!!
Please don't use the root user for that. It is possible to create a new user, name it "shutdown" or something like that, create a new role like "shutdown", add the "shutdown" role to the "shutdown" user. If you then only give that role the rights to use "Sys.PowerMgmt" that user is only allowed to start/shutdown/reboot the node.
Never a good idea to use the root user and its password in clear text. The password could end up in logs if the command fails to execute and so on.
URLS:
https://pve.proxmox.com/wiki/Proxmox_VE_API
https://forum.proxmox.com/threads/shutdown-the-server-via-api.98125/
https://github.com/Corsinvest/cv4pve-api-dotnet