Spice Connection/Proxmox API Help

TheFunk

Member
Oct 25, 2016
35
4
8
31
Hello all!

I'm trying to connect one of my thin clients to a Proxmox VM via Spice. I started using Opaque, and while I'm close to establishing a connection, I have not been able to yet. I believe my issue is that I don't fully understand the Proxmox API yet, and as such my requests to the server are not returning the correct info.

So my question is, using something like Opaque, how should I input my server name, in order to request the appropriate details from the server? At the moment, I'm using <MyIPAdrress>:8006. When I try this, Opaque returns a null exception and tells me the hostname can't be null. My guess is that I'm supposed to format the URL so that I request a specific node and a specific VM, that way my GET request is formatted correctly.

Can anyone help me out a little?
 
If you point your browser to <host-ip>:8006/api2/html you can click through the API interactively. That's pretty handy for tasks like these.
I'd expect the URL to end on something like nodes/<node-name>/spiceshell on the guest IP.
However I'm getting a null there, too. The html view shows a "not implemented" message. Looking through the JS I found that request to be POST.
 
even more handy is the API viewer:
https://pve.proxmox.com/pve-docs/api-viewer/index.html (or https://IP:8006/pve-docs/api-viewer/index.html for your local built-in copy ;))

the paths you are looking for are
/nodes/{NODE}/spiceshell and /nodes/{NODE}/qemu/{VMID}/spiceproxy

both generate a virt-viewer/remote-viewer compatible config file containing all the data needed to connect. note that the spice connection is proxied on the PVE side by a service called spiceproxy, so the actual connect URL in the config (under the 'host' key) is not a real reachable one, but something handled by spiceproxy to determine the actual target. the 'password' is a ticket with a short (30s) validity period.

if you use a client which does not understand the config file, you probably need to pass it at least the proxy, host and password values (and potentially make the cluster CA certificate trusted somehow). you need to get a new config file via the API for every connection (attempt).
 

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!