proxmox-connector/notes/pve-api.txt

21 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2022-01-19 11:31:24 +02:00
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:
2022-11-24 18:51:08 +02:00
curl https://yourip:8006/api2/json//nodes/proxmox/stop -k -d 'username=root@pam&password=yourpassword'
2022-01-19 11:31:24 +02:00
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
2022-04-07 08:27:42 +03:00
API Viewer: https://pve.proxmox.com/pve-docs/api-viewer/index.html