[SOLVED] Empty API Response When Getting VMs

APag96

New Member
Nov 20, 2020
6
1
1
34
I'm trying to get a list of all VMs (no containers yet) running on my Proxmox v6.2 server (node name is "pve") using the Proxmox API. I've been referring to the API docs here. There are currently ten running VMs.

I created a user "api-user@pam" and created a token for the user named "main". I then created a permission for the token for the path "/vms" and gave it the "PVEAuditor" role with propagation enabled. I want this user to just have read-only permission.

For some reason, I'm getting back an empty array when I send a GET to "/api2/json/nodes/pve/qemu"

Bash:
$ curl -i -k -H 'Authorization: PVEAPIToken=api-user@pam!main=REDACTEDTOKEN' 'https://REDACTEDSERVERIP:8006/api2/json/nodes/pve/qemu'
HTTP/1.1 200 OK
Cache-Control: max-age=0
Connection: Keep-Alive
Connection: Keep-Alive
Date: Mon, 07 Dec 2020 22:01:52 GMT
Pragma: no-cache
Server: pve-api-daemon/3.0
Content-Length: 11
Content-Type: application/json;charset=UTF-8
Expires: Mon, 07 Dec 2020 22:01:52 GMT

{"data":[]}

Am I overlooking something, or should I be getting a list of all QEMU/KVM VMs running on my server?
 
Last edited:
has the api token the correct permissions to see the vms ?
 
has the api token the correct permissions to see the vms ?

Thank you for your reply. Here's the relevant portion from my original post to answer your question:
I then created a permission for the token for the path "/vms" and gave it the "PVEAuditor" role with propagation enabled. I want this user to just have read-only permission.

Is this the correct permission needed?
 
I found the problem. I needed to add a permission for the token AND the user the token was tied to. Everything's working now.
 
  • Like
Reactions: Machine Manager
I found the problem. I needed to add a permission for the token AND the user the token was tied to. Everything's working now.

I just faced the same issue, and thanks to this thread I figured out this was actually caused by the option Privilege Separation in the token's options.
 

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!