Please help about API

BlueWeb

New Member
Dec 11, 2019
2
0
1
30
Hello to everyone,

I'm a software developer,
I want to integrate API proxmox for my customers.
After sending the virtual machine creation command, I get errors that I cannot make sense of.
The parameters I send are as follows:

JSON:
{
  "vmid": 102,
  "start": 1,
  "startdate": "2019-12-12",
  "tablet": 1,
  "name": "tstad2d1d22",
  "storage": "local",
  "ostype": "l24",
  "bios": "ovmf",
  "machine": "q35",
  "sockets": "2",
  "cores": "3",
  "memory": "640",
  "vga": "type=std",
  "cpu": "cputype=pentium",
  "ciuser": "root",
  "cipassword": "x2ntsf98",
  "citype": "nocloud",
  "scsihw": "lsi",
  "agent": "enabled=1",
  "net[0]": "model=Realtek RTL8139",
  "scsi[0]": "disk,file=ubuntu-18.04.1-live-server-amd64.iso,size=32,format=qcow2,cache=,discard=ignore,ssd=0,backup=1,aio=native,replicate=1",
  "onboot": 0
}

Return Response:

JSON:
{
  "errors": {
    "tablet": "property is not defined in schema and the schema does not allow additional properties",
    "bios": "property is not defined in schema and the schema does not allow additional properties",
    "ostype": "value 'l24' does not have a value in the enumeration 'debian, ubuntu, centos, fedora, opensuse, archlinux, alpine, gentoo, unmanaged'",
    "machine": "property is not defined in schema and the schema does not allow additional properties",
    "cpu": "property is not defined in schema and the schema does not allow additional properties",
    "name": "property is not defined in schema and the schema does not allow additional properties",
    "net[0]": "property is not defined in schema and the schema does not allow additional properties",
    "citype": "property is not defined in schema and the schema does not allow additional properties",
    "startdate": "property is not defined in schema and the schema does not allow additional properties",
    "agent": "property is not defined in schema and the schema does not allow additional properties",
    "sockets": "property is not defined in schema and the schema does not allow additional properties",
    "vga": "property is not defined in schema and the schema does not allow additional properties",
    "cipassword": "property is not defined in schema and the schema does not allow additional properties",
    "scsihw": "property is not defined in schema and the schema does not allow additional properties",
    "scsi[0]": "property is not defined in schema and the schema does not allow additional properties",
    "ciuser": "property is not defined in schema and the schema does not allow additional properties",
    "ostemplate": "property is missing and it is not optional"
  },
  "data": null
}
 
hi,

looks like you got confused.

'debian, ubuntu, centos, fedora, opensuse, archlinux, alpine, gentoo, unmanaged'

these are for containers, not VMs. probably you're sending your request to the wrong endpoint (i'm guessing you want to create a VM, based on the values you're sending)

also scsi[0] is wrong, there shouldn't be brackets around (on the api-viewer it's written like that as a placeholder. maybe we can make that more obvious)
 
  • Like
Reactions: BlueWeb
hi,

looks like you got confused.



these are for containers, not VMs. probably you're sending your request to the wrong endpoint (i'm guessing you want to create a VM, based on the values you're sending)

also scsi[0] is wrong, there shouldn't be brackets around (on the api-viewer it's written like that as a placeholder. maybe we can make that more obvious)

Hi,

I prepared my page to be the same as Proxmox virtual machine creation screen (see: http://prntscr.com/q9yl2w).
I am using the documentation on pve.proxmox.com.
Path Used: POST /nodes/{node}/qemu

How do I correctly write "scsi [0]"? Can you give an example?

Another question I'd like to ask.
Why might it be giving an error to "name,ciuser, cipassword" parameters?

Thank you for your reply.
 
hi,

Path Used: POST /nodes/{node}/qemu
the response you are getting is seemingly comparing the values you sent to the container schema. most of these options don't exist (or have different names) for containers, that's why you're getting property is not defined in schema and the schema does not allow additional properties

How do I correctly write "scsi [0]"? Can you give an example?

sure, just scsiX, for example scsi0 or 1,2,3,4, etc. also the same way for net0

Another question I'd like to ask.
Why might it be giving an error to "name,ciuser, cipassword" parameters?

if you mistakenly used the container endpoint like i suspect, these are not defined in the container schema (containers do not use cloudinit)

maybe show us the relevant bit of your code (if you are allowed to and you don't mind), and we can help you debug further
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!