API and Spice

eglyn

Member
Aug 26, 2021
26
2
8
45
Hi everyone,

I want to access spice console through the API.
I have a test user which have PVEVMUser permission on a test VM.
This VM has Spice activate, and when I open Proxmox webconsole with this user, I can launch Spice console, it downloads a vv file that I can open.

But, when I go into the API to URL /api2/json/nodes/nodename/qemu/102/spiceproxy, I have a null value...

I looked for documentation, and I found only this api url to access to the spice console.
And when I use this API url, I have an http 501 error :(

So, what I am doing bad ?

My purpose is to make a php website for users to access to their VM with Spice, without using proxmox webconsole directly.

Thx !
 
Hi
I just got the same problem as you and finaly found why
In the hardware tab of the VM, the display need to be compatible with Spice. "Default" are not.
Power off the VM, change display for "VirtIO-GPU" or any SPICE and power on the VM.
The "Spice" menu in Console should not be grayed ouy and the API /api2/json/nodes/{node}/qemu/{vmid}/spiceproxy should return a JSON
(Don't forget to do a POST and add CSRFPreventionToken header when calling this API)

proxmox.png
 
Last edited: