Get vmwarefolderId List

Hello team,
How can i create an option list that will gather all the forlderIds of a specific vmware cloud ?


can’t find any api into the swagger :frowning:

The API endpoint for that is documented here: Retrieves all resource folders for Specified Cloud

Hello, thank you for your answer.

I’ve managed to get it work on a specified cloud :

with this translation script :

console.log('DEBUG REST OL : '+data['folders'].length)
for (var x = 0; x < data['folders'].length; x++) {
console.log('DEBUG REST OL : value no '+x+' = '+data['folders'][x].name)

do you have an idea to do it with having cloud as an input in a catalog item ?
The final goal is to choose a cloud tighted to a vmware cluster in a catalog item, an then be able to choose the folder in which the VM will be created


Hi Matthieu,

For this use case you can use the option source url: /api/options/vmware/vmwareFolders?zoneId=354
To use this in a catalog item, set the option list Source URL to https://morpheus-dev/
Then on the folder input you can specify the zoneId query parameter as the value from your cloud input in the request script, for this example I’ve assumed the cloud input name is morpheusCloud so the request script is:

results.push({name: 'zoneId', value : data.morpheusCloud});

Finally, you also need to change your translation script to match the json response structure from the new url, so the translation script is:

console.log('DEBUG REST OL : '+data['data'].length)
for (var x = 0; x < data['data'].length; x++) {
console.log('DEBUG REST OL : value no '+x+' = '+data['data'][x].name)

That should do it, just let us know.


1 Like

Hello James,
It works perfectly fine.
Thank you