PVE API Return Values

Ryan Anderson

Active Member
Mar 9, 2018
19
2
43
44
Can anyone tell me why I'm only getting some of the information for the config when I use the API? I'm really wanting the Memory/vCPUs/ and HD Size. This it the only information I'm getting from: /api2/json/nodes/{node}/qemu/{vmid}/config. However the API documentation show a whole lot more information that is supposed to be returned.

"data": {
"sata0": "zfs_01:vm-505-cloudinit,media=cdrom",
"tags": "<TAGS>",
"ciuser": "ciuser",
"virtio0": "zfs_01:vm-505-disk-0,size=32G",
"vmgenid": "9867ad27-9269-4389-8629-ce0d5264282d",
"net0": "virtio=BC:24:11:D6:8C:4E,bridge=vmbr0",
"cipassword": "**********",
"digest": "5441dc85f467c666d3b77a66f784cecbf89ba609",
"meta": "creation-qemu=9.0.2,ctime=1729342540",
"boot": " ",
"ipconfig0": "",
"smbios1": "",
"description": "",
"agent": "1,fstrim_cloned_disks=1",
"name": "<NAME>"
}

I'm building a NextJS app and trying to get details (Name, Memory, vCPUs, HD Size, IP Address(es)) of certain machines. If there is a better way to get this info, I'm all ears.
 
Hi @Ryan Anderson ,

One explanation - the values you are looking for were not specified. For example:
Code:
root@pve-1:~# qm create 998
root@pve-1:~# pvesh get /nodes/pve-1/qemu/998/config --output-format json-pretty
{
   "boot" : " ",
   "digest" : "a0097e911e7c535d4b392072fedc19c917a41422",
   "meta" : "creation-qemu=9.0.2,ctime=1729737506",
   "smbios1" : "uuid=b5a02048-58ac-494c-9a6a-05396cba4780",
   "vmgenid" : "5badf2d5-4f3c-4364-be7c-d076f4d1594e"
}

If the above is not the case, you should:
a) provide PVE version: pveversion
b) provide configuration file: qm config [vmid]
c) reproduce the issue with "pvesh" as above
Note that IP address will only be available via "config" call if its set statically via PVE.

Good luck

P.S. the above minimal VM has some defaults described in "qm" man page , as well as Proxmox API documentation, i.e.:

Code:
 --cores <integer> (1 - N) (default = 1)
           The number of cores per socket.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
I'm on Proxmox 8.2.4. Below is the result of the pvesh get command. It doesn't have this information in the config file, but the API documentation says this is optional information, I guess I'm confused on how to see what resources are allocated to this machine. I can see the HD size and could grab that, but th enumber of cpus and memory isn't here.

Code:
{
   "agent" : "1,fstrim_cloned_disks=1",
   "boot" : " ",
   "cipassword" : "**********",
   "ciuser" : "ryleesnet",
   "description" : "Mini Server",
   "digest" : "5441dc85f467c666d3b77a66f784cecbf89ba609",
   "ipconfig0" : "ip6=2600:1700:1c34:815c::11/64,gw6=fe80::7a45:58ff:fef7:62dd,ip=dhcp",
   "meta" : "creation-qemu=9.0.2,ctime=1729342540",
   "name" : "ryleesnet",
   "net0" : "virtio=BC:24:11:D6:8C:4E,bridge=vmbr0",
   "sata0" : "zfs_01:vm-505-cloudinit,media=cdrom",
   "smbios1" : "uuid=69038cc9-17ef-43bb-a4d9-e2af1e986e20",
   "tags" : "BC1YLijd5XEneHzVd5VFb2mgdNkRpPneNWY6fKJ3ptBVJ5guqAnPSke",
   "virtio0" : "zfs_01:vm-505-disk-0,size=32G",
   "vmgenid" : "9867ad27-9269-4389-8629-ce0d5264282d"
}
 
It looks like I need to get the CPUs, Memory, and Disk size from /nodes/{node}/qemu/{vmid}/status/current instead. That is giving me the information I need.
 

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!