Using the HTTP API

DoruB

New Member
Sep 11, 2017
11
0
1
33
Hello,

I need to use the HTTP API to extract VM info from one of my Proxmox clusters.

The API call which I want to use is:
Code:
GET /api2/json/cluster/resources
, however, by default this call returns other resources like Pools, Nodes, Storage etc.

How can I pass an optional parameter using the HTTP technique?

I tried using:
Code:
curl -XGET --silent -k -H $(cat token) -b $(cat cookie) https://10.109.5.44:8006/api2/json/cluster/resources -type=vm | jq .
but this won't filter anything.

For example in CLI I can use:
Code:
pvesh get /cluster/resources -type=vm
, this returning exactly the information I'm interested in.
 
You need to pass the parameters as part of the url:

Code:
curl -XGET --silent -k -H $(cat token) -b $(cat cookie) https://10.109.5.44:8006/api2/json/cluster/resources?type=vm