vncproxy API Docs enhancements request // screenshot API Endpoint request

flyinghuman

Member
Jul 14, 2022
4
1
8
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}/vncproxy
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/vncwebsocket

in the Documentation (link above) the fact is missing that you need a
Code:
PVEAuthCookie
so that you can access the remote console trough API. This costs me 2 Days to figure it out. Please add the corresponding Information to the Documentation. Thanks!

The Workflow that finally worked for me is:
1. GET /api2/json/cluster/resources?type=vm` (discover the active node for the VM).
2. GET /api2/json/access/ticket to get the
Code:
PVEAuthCookie
and optionally
Code:
CSRFPreventionToken
with Header
Code:
Authorization: PVEAPIToken=<user>@pve!<tokenname>=<your-token>
3. POST /api2/json/nodes/{node}/qemu/{vmid}/vncproxy with
Code:
generate-password=0, websocket=1
to open the port for 10 Seconds. Returns vncticket and port number.
4. GET websocket target: `wss://<host>:8006/api2/json/nodes/<node>/qemu/<vmid>/vncwebsocket?port=<port>&vncticket=<ticket>

Of course you will need a websocket proxy to access the raw data. i use stock novnc library to display it in browser with custom controls.

It would be really good to also have a screenshot API Endpoint to get a live screenshot from console for displaying at remote sites like in the PDM.

If you are wondering why i do this: i build a custom Frontend for Proxmox Backend so that the Users must not login on the Prxomox Servers itself.