Hi Team,
I am planning to use Morpheus API in the REST option list to retrieve instance name and IP.However it’s not populating any value not sure where I missed the values.
Below is the Translation Script:
for (var x = 0; x < data.length; x++) {
results.push({name:data.instances[0].id, value:data.instances[0].id});
}
Hi Ibrahim,
Translation script
for (var x = 0; x < data.instances.length; x++) {
results.push({name:data.instances.name, value:data.instances.connectionInfo.ip});
}
Thanks
Velan
2 Likes
Thanks, Velan. Its working as expected.
Hi Velan,
As I checked I am able to see only the VM name. But if I changes name into IP its not showing any value.Also if I print the value its shows as null.
for (var x = 0; x < data.instances.length; x++) {
results.push({name:data.instances.connectionInfo.ip, value:data.instances.connectionInfo.ip});
}
Hi Velan,
Do you have any workaround on the above one?
Regards,
Ibrahim K
Hi Ibrahim,
As connectionInfo is an array object, could you please try the below snippet.
for(var i=0; i<data.instances.length; i++) {
results.push({name: data.instances[i].name, value: data.instances[i].connectionInfo[0].ip});
}
Thanks
Velan
1 Like