Proxmox API – clone and start VM

t9omek

New Member
Feb 24, 2021
3
0
1
31
Hi,

I'd like to automate the use of proxmox. I care about copying and starting the VM.

I was able to achieve this with the CLI with the command:

Pvesh create /nodes/pve/quemu/100/clone –newid 102

Do you know how this can be achieved using the API?

I tried

POST /api2/json/nodes/{node}/qemu/{vmid}/clone
but it doesn't work


s1.png
 

Attachments

  • s1.png
    s1.png
    115.4 KB · Views: 19
May you try to use extjs instead of json like:

Code:
POST /api2/extjs/nodes/{node}/qemu/{vmid}/clone
 
Unfortunately it does not work. I get message 1. Does this command require additional configuration?s1.png
 
I don't use postman just with curl command e.g.

Bash:
curl -i -s -k -X $'POST' -H $'Csrfpreventiontoken: {Csrf-TOKEN}' -b $'PVEAuthCookie=PVE:{Cookie}' --data-binary $'newid={VMID}&name={NEWNAME}&target={NODE}&full=1'  $'https://192.168.1.99:8006/api2/extjs/nodes/{NODE}/qemu/{VMID}/clone'

EDIT: but maybe you forget the data [0]

[0] https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/qemu/{vmid}/clone
 
Last edited:
If you are looking for a way to do it in Python, you might want to check out the Proxmoxer library. It takes care of all the authentication and API call logic and just lets you call the endpoints you need. You can check out the readme in the repo or the new (still a work in progress) documentation site. If you have any problems using it, feel free to message me or open an issue!
 
  • Like
Reactions: Moayad