Initiate API without initial value?

Hi All, newbie here…

How do I set an API up so it doesn’t call using a stored parameter, when the page is loaded?

I have setup an API ‘GET’ call that includes the parameter [term]. This parameter is replaced by whatever the user enters into a text-input field on my main page. This is working, however, when the page loads, a GET call seems to happen using the stored term (‘Cat’ in the image below). If I remove ‘Cat’ and leave the value field blank, the API doesn’t work. This isn’t what I want as when the page loads, search results ae being displayed for ‘Cat’ before the user enters a search term.

Thanks for your help.

Nick

When you call this API on your page, be sure to remove “cat” from the parameter options and replace it with the search field input.

Hi t_bubble,

When I call the API form the page it seems to replace ‘Cat’ with the correct term, however, when the page loads it seems to do a call immediately using ‘Cat’. How do I stop it doing this first call?

Thanks

I imagine, the API is being used as a datasource for a repeating group. The API is called as soon as the repeating group loads, if you can condition the repeating group to show hwn the user has typed a couple characters or on the press of the search button, you can avoid an empty call (which then takes the initialization value). Alternatively, you can also set a conditional source on the repeating group, switch the API data source when the search input box is not empty.

Ah, yes, it is populating a repeating group… I’ll look into the various solutions you have suggested. That’s great, thank you!

EDIT: Figured it out - I had the param set to ‘private’ originally. Now it shows up! Thanks :smiley:

Hi can I ask here since it seems you’ll know the answer - How do I set the GET Param in the page, or as the page loads? I’ve successfully printed my RepeatingGroup with results of my GET for a base term (in your case, ‘cat’), but I don’t see where in the UIBuilder to add/set the Param update.

I’m guessing it might be a background workflow (hidden group on load?) that reads my User’s stored param and sends it to the API call?

You can define the data group and leave the source empty :slight_smile:

Now you will be able to set a list of data using workflow actions.

Once you are able to successfully initialize the API call in API connector, just remove the value from it and it will not come up in Design or workflow

1 Like