HPE Morpheus Enterprise
1829619 Members
2758 Online
109992 Solutions
New Discussion

How to grab data from an API for a typeahead option type?

 
Not applicable

How to grab data from an API for a typeahead option type?

Hi team,

Does anyone has any idea on how to make an option type of type “typeahead” to bring data from an API in real time? (as it seems this is working only when the option type is of type “Select list”), so we are looking for any advice or recommendation for this.

Note that the option list that is linked to the typeahead field (option type) is already configured to grab data via API in real time.

Thanks for your inputs! :slight_smile:

6 REPLIES 6
Not applicable

Re: How to grab data from an API for a typeahead option type?

Correct. The cloud ID variable of the cloud previously selected where to build the instance.

Not applicable

Re: How to grab data from an API for a typeahead option type?

So, to be clear, this input requires selection of a previous input in order to populate?

Not applicable

Re: How to grab data from an API for a typeahead option type?

Thank you @ncelebic for your response.

We found another issue: we need to pass a variable to the API we try to trigger to filter the data to be populated in the typeahead input, but it marks an error and the API request cannot be completed, as this value is expected.

Please see attached the screenshots of our configuration and the error msg.


Not applicable

Re: How to grab data from an API for a typeahead option type?

No, that was just what the API return was. I used title and the value was the id.

Not applicable

Re: How to grab data from an API for a typeahead option type?

@ncelebic so with type ahead it is data.title and not data.name?

Not applicable

Re: How to grab data from an API for a typeahead option type?

Hi @AnaDuranAZ.

I made a simple REST option list from this endpoint: https://api.sampleapis.com/coffee/hot and using the following translation script:

for(var x=0;x < data.length; x++) {
  results.push({name: data[x].title,value:data[x].id});
}

I’m using a typeahead input with the option list selected. I added the input to an operational workflow and I’m able to use typeahead to select items out of the list. I have a screen grab here: Screencast at August 10th 2022 - 4.02.46 pm.mp4 - Droplr

I may be misinterpreting what you’re asking.