Finding ids of items like clusters and vm folders under a provider

I am working on building an indirect form or menu which pulls data from cloudforms and presents it as a dynamic drop down field in service now. We are currently building the form to find the IDs which would customize the placement of a VM upon deployment.

We have multiple “providers” or vmware vcenters and unfortunately the collections part of the API (https://miq.local/api/clusters ) does not have a field to show which provider a Cluster is apart of. Rather than me renaming all of the clusters to make a filter I would like to see if there is a way to find this under the ext_management_system.name attribute somehow.

I saw some posts of potentially finding this by running reports, but I dont think that would be an efficient way to get the cluster names.

I believe I found part of the solution. It looks like there is a hidden field for ext_management_system.name within the cluster api call.

https://cloudforms.somedomain.local/api/clusters?expand=resources&attributes=id,name,ext_management_system.name&filter[]=ext_management_system.name=’%VC1%’&sort_by=name&sort_order=ascending&sort_options=ignore_case

This yields something like this:
{
“name”: “clusters”,
“count”: 20,
“subcount”: 12,
“subquery_count”: 12,
“pages”: 1,
“resources”: [
{
“href”: “https://cloudforms.ad.bcm.edu/api/clusters/1000000000003”,
“id”: “1000000000003”,
“name”: “EPIC_CACHE”,
“ext_management_system”: {
“name”: “VMware-VC1”
}
},
{
“href”: “https://cloudforms.ad.bcm.edu/api/clusters/1000000000029”,
“id”: “1000000000029”,
“name”: “H1_T0_IMS-CORE-SVCS”,
“ext_management_system”: {
“name”: “VMware-VC1”
}
},
{
“href”: “https://cloudforms.ad.bcm.edu/api/clusters/1000000000016”,
“id”: “1000000000016”,
“name”: “H1_T1_EPIC”,
“ext_management_system”: {
“name”: “VMware-VC1”
}
},
{
“href”: “https://cloudforms.ad.bcm.edu/api/clusters/1000000000025”,
“id”: “1000000000025”,
“name”: “H1_T1-T3_Production-Broadwell”,
“ext_management_system”: {
“name”: “VMware-VC1”
}
},
… and so on.

I am still working to try to find the vm folder option if anyone has any tips I would appreciate it.

Glad you were able to find it. I believe ext_management_system.name is the right field. For folders, we discussed in another topic here recently, but I think it will require API changes to expose it.