How to have a REST GET after search field entered

I am doing a proof of concept and require the following functionality. I have a search field on a page and after the text is entered, I need to call a REST GET and pass the search text as a parameter. Is there any example of this or can someone give me some guidance.

So to summarize, I need to know how to add the query string and how to conditionally make the REST call.

Thanks

Bruce

Hi Bruce,

Input fields have onChange, onFocus and onBlur events that you can use to trigger the API calls. You can access these on the logic canvas.

Here’s a dummy example of a logic flow where an API is called whenever the input field is blurred, and the response is then stored in a page variable to be able to display the search results.

In the Get record node the input component’s value, is bound to the “id” input property to make the right query (the value has been stringified here for compatibility, since it can also be a number). In the next node, the value of the searchResults page variable is bound to the output of the previous node that contains the API response.

Hope this helped!

Hi, for some reason I don’t have this events in my options list. Do I have to add them ? @Mari

Double click on the input field to go to isolation mode.

You’ll see the events you’re looking for.

Set the event to a triggered event:

Then set your component tap to event fired from triggered event.

Go back into isolation mode and set the triggered events to be the component tap.

Thank you @Zach_Duffy !!! :blush:

1 Like

Im so glad it worked for you!