VM Create/Edit/Delete with API

Hi,
Yes it is.
Post on path /nodes/<Nodename>/qemu
 
Thank you for your answer.
How do I send specific values via API?
For example;

PHP:
$url = 'https://101.101.101.101:8006/api2/json/nodes/<NODE>/qemu/';
$fields = array(
   'vmid' => urlencode($_POST['vmid']),
   'cores' => urlencode($_POST['cores']),
   'sockets' => urlencode($_POST['sockets']),
   'name' => urlencode($_POST['name']),
   'memory' => urlencode($_POST['memory']),
   'onboot' => urlencode($_POST['onboot'])
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

Could it be a correct CURL?
 
Thank you for your answer, really
I understand. Could you tell me that? Can I create or clone VM with API?
Hi,
found your post during an search.

So you can create an vm with pvesh (you must adapt that for php):
Code:
pvesh create /nodes/pve01/qemu -name special-vm -vmid 123 \
             -scsi0 local-lvm:32 \
             -memory 4096 -cpu host -socket 2 -cores 2 \
             -net0 virtio,bridge=vmbr0 \
             -cdrom backup:iso/debian9.iso
Udo
 
Hi,
found your post during an search.

So you can create an vm with pvesh (you must adapt that for php):
Code:
pvesh create /nodes/pve01/qemu -name special-vm -vmid 123 \
             -scsi0 local-lvm:32 \
             -memory 4096 -cpu host -socket 2 -cores 2 \
             -net0 virtio,bridge=vmbr0 \
             -cdrom backup:iso/debian9.iso
Udo

Thank you Udo!