API connector should be initialized to empty

I am using a search API and I have to initialize the call with a search parameter defined so that Bubble knows the fields in the response.

When I use the API in a repeating group, it displays the initialized response results to start with. I want it blank.

When I type an input value and do a search the call is made and the correct results are displayed.

If I initialize the call without a query value, or a blank one, Bubble won’t know the shape of the response.

I have tried clearing the repeating group list via a workflow, on various events.

You have to unselect the “private” checkbox.
Private fields are supposed to be for non-changeable/sensitive parameters.
If you unselect it, you’ll be able to dynamicallly change the parameter from the frontend.

1 Like

That doesn’t seem to make a difference. I was able to dynamically change the search parmater from the front end, and redo the search.

I unchcked them in the API connector anyway, and reinitialized, but I still get the initialized response displayed the first time.

Are you referring to the initialised response? The initialied response will always be with the initialisatiion parameters.

After you have initialised it, you will be able to get different responses from the frontend if you change the parameters. But you have to run it from the frontend.

How do I clear it? It displays in my repeating group as soon as the RG is shown, before I’ve done anything. Subsequently it updates correctly when I change the parameter from the frontend.

Leave the RG datasource empty…

Then either use a condition or a workflow to set the datasource when the search input is changed or the search button is clicked etc.

2 Likes

As @adamhholmes said, leaving the RG empty is a great solution.

You could also consider using the API as an action instead of data. This would give you more control over when you want to trigger the API.

I cannot get this to work consistently.

I had followed this tutorial to show/hide my group focus correctly https://www.youtube.com/watch?v=gF8mpZtfWLU

I was conditionally setting the data source for the RG, to prevent the first display of API Connector initialised data, but the workflow for the RG clicked was not firing.

I tried moving the conditionals to the Group Focus and passing down the data source to the RG, that didn’t work.

This seems like a pretty common autocomplete feature, click on an input and display some search results in a RG, possibly from a 3rd party API, click one of the results, close the list and populate some inputs. What am I doing wrong?

There isn’t a workflow for RG is clicked… what workflow were you using?

It is definitely something achievable, but it’s hard to tell what you’re doing wrong without screenshots. Add some screenshots of your set up.

Also what exactly is not working? Can you be a bit more specific
Is the group focus not appearing, is the API not firing, is the RG empty…etc

The group focus is showing and hiding correctly.

When I said RG clicked I really meant the row Group within the RG, so clicking anywhere on the row, which I’m able to add a workflow to.

The API is being called and the RG list is displaying data, but clicking the RG row doesn’t do anything. I was trying to set state, or pass the data to a group of inputs.

I thought it might be to do with dynamically setting the RG data source and/or the fact that the RG is in a GroupFocus.

Really appreciate the help. When I finally get it working, this would make a very useful autocomplete tutorial for Bubble beginners!

I will put together some screenshots.

When you click the RG row, what is you workflow doing exactly? Can you share a screenshot of that workflow please.
How are you trying to pass data to inputs? Do you have the initial content of the inputs set to a custom state which is set during the above workflow?

These things don’t cause problems in general.

Ok I got it working.

I think I might have hade an extra nested Group in place that prevented the workflow from running.

I used the Display data in group in the workflow, to set the inputs to the row selected from the RG.

Hey @mdl.vendors , I have the exact same problem. How did you solve it? and do you know why you always get the initalized value ?