I am currently looking for a a way to query /api/vcenter/host and filter all hosts in a specific cluster.
I see some filters available like ?filter.clusters= but none of them seem to work for me.
List all hosts in a specific cluster:
-----------------------------------------
GET: https://{vc}/api/vcenter/host?clusters=<cluster_id>&connection_states=CONNECTED
cluster_id = Identifier of the cluster
Eg:
https://{vc}/api/vcenter/host?clusters=domain-c8&connection_states=CONNECTED
How to get cluster_id:
----------------------------
List Clusters - GET: https://{vc}/api/vcenter/cluster
Res:
{
"drs_enabled": true,
"cluster": "domain-c8",
"name": "docker-cluster",
"ha_enabled": false
}
List all hosts in a specific cluster:
-----------------------------------------
GET: https://{vc}/api/vcenter/host?clusters=<cluster_id>&connection_states=CONNECTED
cluster_id = Identifier of the cluster
Eg:
https://{vc}/api/vcenter/host?clusters=domain-c8&connection_states=CONNECTED
How to get cluster_id:
----------------------------
List Clusters - GET: https://{vc}/api/vcenter/cluster
Res:
{
"drs_enabled": true,
"cluster": "domain-c8",
"name": "docker-cluster",
"ha_enabled": false
}
This is exactly what I was looking for. Works perfect.
Thank You...