api view description vm

Kosh

Well-Known Member
Dec 24, 2019
85
6
48
45
Hi
pvesh get /nodes/{node}/qemu/{vmid}/config
there is a description argument but it does not display the vm description

having completed pvesh get /nodes/{node}/qemu/{vmid}/config -description


I get an error
Code:
Unknown option: description
400 unable to parse option
pvesh get <api_path> [OPTIONS] [FORMAT_OPTIONS]
 
that API endpoint returns the config, including the "description". there is no way to query just the description via the API, you'd have to use the json format and parse that..
 
node=$(hostname); vmid=112; pvesh get /nodes/${node}/qemu/${vmid}/config --noborder 1 |grep desc


description 2024.feb win10 22H2 fresh install for BOINC
 
Hi
how to correctly compose api requests via curl (pvesh is not suitable) I read both the wiki and the api instruktion, but it didn’t become any clearer

I have a command which I get to display the vm description
curl -k -X GET \
'https://cloud-a001:8006/api2/json/nodes/cloud-a001/qemu/113/config' \
-H 'Authorization: PVEAPIToken=root@pam!monitoring=8d495e45-xxx-yyy-zzzz-fgdgdfgdfg160a0' \
| jq -r '.[].description'

What will the command to change/add a description look like?


PS figured it out myself :)

curl -k -X POST \
'https://cloud-a001:8006/api2/json/nodes/cloud-a001/qemu/113/config' \
-H 'Authorization: PVEAPIToken=root@pam!monitoring=8d495e45-xxx-yyy-zzzz-fgdgdfgdfg160a0' \
-H "Content-Type: application/json" \
-d '{"description":"TEST"}'
 
Last edited:
  • Like
Reactions: fabian
but you probably want to rotate that token secret now ;)
 
  • Like
Reactions: Kosh