Get IP addr of VMs in Option Li

I need the IP address of all the VMs that have been provisioned to be listed on Catalogue Item input dropdown. I am able to get the hostname of the VMs listed on the input dropdown by using Morpheus API option in Option List. However, in my use case, I need the IP address and not the hostnames.
I tried using retrieving the IP address using REST in the Option List. However, that did not work out. How can I achieve this? Any help on this is much appreciated.
Thanks.
Vineeth.

Host endpoint returns externalIp, internalIp, please find the below API doc link.

Thanks for the prompt response, Senthil.
The link you shared retrieves the list of servers while I am looking for list of VMs. I got the enpoint for VMs and I even tried with that but to no avail.

I am specifically looking guidance on how to construct the REST call to retrieve ONLY the IP address of the VMs. I tried with the below request but I am getting “Bad request” error

https://CHANGE_ME/api/instances?max=25&offset=0&showDeleted=false&instances.connectionInfo[0].ip
Can you please help?

instance.connectionInfo as a parameter is not supported to list all instances as per the doc.
you can use details as parameter to list more information for instances.
https://changeme/api/instances?max=25&offset=0&showDeleted=false&details=true

I would suggest you create 2 option inputs, one with Morpheus API to list all instances, and based on the selected instance the other option inputs with REST will fetch all ips associated to the selected VM.
REST option URI : https://changeme/api/servers?name=vmname&max=25&offset=0

I have not tried that approach yet. I will give it a try and get back. Thanks!

Hello Senthil,
As per your suggestion, I have created 2 Option Lists, one for taking the hostname of the VM and the 2nd one for making a REST call based on the host name selected from Op.List1.
However, I am not aware of the syntax to pass the host name from the Op.List1 as a variable to the Op.List2.
https://192.168.5.32/api/servers?name={host_name_variable}&max=25&offset=0
What should be the syntax for the host name in the REST API endpoint?
Can you please guide me on this?
Thanks,
Vineeth.

Hi Vineeth,

REST url is “/api/instances”
request script is as below
results.name = Op.List1

Thanks
Velan