[SOLVED] Empty API Response When Getting VMs

APag96

New Member
Nov 20, 2020
6
1
1
35
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.

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.