[PVE-User] Clone a qemu template with API in HTTP

Cédric Bernard cbernard at deezer.com
Thu Mar 2 17:38:09 CET 2017


Thanks for the information :)

I had not though to view the curl command on Chrome :)

It works with the curl command generated on Chrome. So I can compare it
with my curl command to understand why my command fails.


2017-03-02 16:38 GMT+01:00 Fabian Grünbichler <f.gruenbichler at proxmox.com>:

> On Thu, Mar 02, 2017 at 02:41:16PM +0000, Cédric Bernard wrote:
> > Hello
> >
> > I try to clone a qemu template with the API in HTTP but i have a "null"
> > result.
> >
> > I use this command :
> > curl --silent --insecure --cookie "$(<~/cookie)" --header
> "$(<~/csrftoken)"
> > -X POST --data name=dzr-mythugvm-01 --data newid=1001 --data
> > target=proxmox-03 --data pool=Infra
> > https://proxmox-01:8006/api2/json/nodes/proxmox-01/qemu/1000/clone
>
> note: you are attempting to do a linked clone from one node to another -
> this will only work with shared storage.
>
> >
> > When I use GET on the url
> > https://proxmox-01:8006/api2/json/nodes/proxmox-01/qemu/1000/, I don't
> see
> > the "clone" feature in the result. I see other features like "config",
> > "pending", "migrate", etc.
>
> that will only show you subdirectories, and clone is an endpoint without
> children.
>
> >
> > I can clone the VM on the web interface and also on the CLI with pvesh
> with
> > the same parameters.
>
> you should be able to view the exact request the GUI does with your
> browser's developer tools - e.g., Chromium's offer a handy "Copy"
> feature for recorded requests, which allows to generate a curl command
> directly :)
>
> >
> > Does this feature exist with the HTTP API ? As it's written here
> > https://pve.proxmox.com/pve-docs/api-viewer/index.html
> >
> > My proxmox version is 4.4, it's up to date.
> >
> > Thanks for your help!
>
> should work, I just checked with the following:
>
> curl 'https://IP:8006/api2/extjs/nodes/NODE/qemu/60000/clone' \
> -H 'Cookie: COOKIECONTENT' -H 'CSRFPreventionToken: CSRFTOKEN' \
> --data 'newid=100001' --data 'name=test' --data 'target=NODE' \
> --compressed --insecure
>
> _______________________________________________
> pve-user mailing list
> pve-user at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-user
>



-- 
Cédric Bernard
System & Security Engineer
Mail: cbernard at deezer.com
Skype : cbernarddeezer

12 rue d'Athènes 75009 Paris - France



More information about the pve-user mailing list