Forum Academy Marketplace Showcase Pricing Features

Replicating the results I achieve in a repeating group using API

Hi there,
I need a “little” help with a project I’m working on. :slight_smile:

I have the following data types in Bubble ;

garage , lead, bridgeGarageLeads.

A garage is a garage registered in my bubble app. :=)
A lead is a prospect who is looking to buy a car.
A bridgeGarageLeads is created when a garage contacts the lead. (This type has 2 fields , bridgeGarage type of Garage and bridgeLead type of Lead)
For every lead contacted by a garage bridgeGarageLeads is created. (if 4 garages contact the same lead there will 4 bridgeGarageLeads with the same Lead ID but different garage IDs)

Here is what I want to do (I can do this in bubble UI)

I need to create an API call to display the Leads belonging to a garage so I can show them in another platform.

I have been trying to do it, but I couldn’t figure out.

In bubble I solve the issue like this,

Repeating group type of bridgeGarageLeads with the constraint = current users Garage

Inside the repeating group I have a group in the cell and type of the content is Lead. Data souce = Current Cells bridgeGarageLead’s bridgeLead

OK, so your App is gonna be the API server

For this, you have to set up a backend workflow that accepts API calls to your Bubble App and returns the corresponding data.
So, when you set up a backend workflow, make sure that it is ‘exposed as a public API workflow’ by checking that box.

Your API workflow can accept data. so if a user wants leads associated with a certain Garage, they will provide a ‘garage_id’ for instance.

Then, in this workflow, add an action to ‘return data from API’ and select the list of Leads here.
You can add multiple such actions and set conditions on them.

For example:
Key: leads | Type: Lead | {tick the ‘List’ checkbox}
Data: Do a search for Garages 's Lists
Only When: garage_id is not empty

Hope this helps.

Ranjit | Blur Apps

Thank you for taking time and responding to my question in such detailed manner.

Your solution is valid for many scenarios but I think it wouldn’t work for the use case I mentioned.

Leads do not contain any information what garage acquired (contacted) those leads.
The relationship between garages and leads are held in a bridge data type called bridgeGarageLeads. This data type has 2 fields lead and garage. The data type acts like a ledger.

So what I need to do list all the bridgeGarageLeads which has the GarageID filtered and THEN grab the lead ID details from them. And finally list all the leads (different data type) based on those lead Ids .

Yes, you will then have to list the relevant bridge item.
Assuming there is a one-one relationship between leads and garages, this can be a way to go.