HPE Morpheus Enterprise Software
1856403 Members
7119 Online
104112 Solutions
New Discussion

API Option list with Morpheus API URL and Parameters

 
SOLVED
Go to solution
AungKT
Regular Advisor

API Option list with Morpheus API URL and Parameters

Hello,

I am trying to call back Morpheus API with parameters for Nutanix Prism categories which need to use in service catalog. I am not getting any data. I can get data if I call to other API without parameters.

This is API URL with parameters > https://morpheus/api/options/typeahead?optionTypeId=2258&zoneId=1&cloudId=1&siteId=1

This is json respond body.

{
“success”: true,
“data”: [
{
“name”: “AppTier:Default”,
“value”: “AppTier:Default”
},
{
“name”: “AppTier:Testing_App_Tier”,
“value”: “AppTier:Testing_App_Tier”
},
{
“name”: “AppType:Apache_Spark”,
“value”: “AppType:Apache_Spark”
}
]
}

Here is my translation script.

results = ;
for (let i = 0; i < data.success.length; i++){
results.push({
name : data.data[i].name,
value : data.data[i].value
})
}

4 REPLIES 4
Ollie-Phillips
HPE Pro

Re: API Option list with Morpheus API URL and Parameters

In your translation script, instead of data.success.length will data.length get you results?



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
AungKT
Regular Advisor

Re: API Option list with Morpheus API URL and Parameters

Thank you so much, it worked.

Ollie-Phillips
HPE Pro

Re: API Option list with Morpheus API URL and Parameters

Ah, very good catch @dgaharwar. Double data



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
dgaharwar
Trusted Contributor
Solution

Re: API Option list with Morpheus API URL and Parameters

Instead of data.success.length use data.data.length