[SOLVED] Injecting QEMU SSH keys via the API

judahnator

New Member
Jun 16, 2022
8
0
1
Hello, forum!

I am running into a bit of trouble. I am using the API to configure a VM (PUT `/api2/json/nodes/{node}/qemu/{vmid}/config`, as documented here).
I receive the following error, only when the 'sshkeys' parameter is present:

Code:
HTTP/1.1 400 Parameter verification failed.

If I omit the 'sshkeys' parameter the request works fine. I was hoping that someone might be able to point me in the right direction on how this feature works. Would anyone happen to have a code snippet that is working for them? Perhaps the keys need to be encoded or terminated in some way.
 
Ah-ha! That was the trick. URL-encoding the string was the ticket.

For anyone in the future that runs into this problem and is using PHP, don't use the `urlencode()` method. You need to use the `rawurlencode()` method here.
 
Glad to hear that it works, please mark this thread as solved so that others with the same problem can find it more easily in the future :)
 

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!