Get current lxc status with API

lord

New Member
Feb 10, 2021
3
1
3
Germany
Hi,

I can't figure out why I'm not able to get the current status for lxc container using the API. I tried this request:

Bash:
curl -s -k -b "PVEAuthCookie=$TICKET" -H "CSRFPreventionToken: $CSRF" -X POST $PVEHOST/api2/json/nodes/$PVENODE/lxc/$VMID/status/current

response: {"data":null}

Tried the same request in the console with pvesh and only this way I get the current status:
Bash:
 pvesh get /nodes/vmhost-2/lxc/109/status/current
┌─────────┬───────────────┐
│ key     │ value         │
╞═════════╪═══════════════╡
│ cpus    │ 2             │
├─────────┼───────────────┤
│ ha      │ {"managed":0} │
├─────────┼───────────────┤
│ lock    │               │
├─────────┼───────────────┤
│ maxdisk │ 4.86 GiB      │
├─────────┼───────────────┤
│ maxmem  │ 512.00 MiB    │
├─────────┼───────────────┤
│ maxswap │ 512.00 MiB    │
├─────────┼───────────────┤
│ name    │ abcdef-v      │
├─────────┼───────────────┤
│ status  │ running       │
├─────────┼───────────────┤
│ uptime  │ 31m 19s       │
├─────────┼───────────────┤
│ vmid    │ 109           │
└─────────┴───────────────┘

Starting and stopping via API with the same token works flawlessly, so Ticket and CSRF seems to be correct:
Code:
curl -s -k -b "PVEAuthCookie=$TICKET" -H "CSRFPreventionToken: $CSRF" -X POST $PVEHOST/api2/json/nodes/$PVENODE/lxc/$VMID/status/start

Any idea whats going wrong with my API call to get the current status?!
Using proxmox ve version 6.3-3.

Thanks a lot. :)
 
Last edited: