Nested API calls - Reducing API calls

Dear community, I will need your help once again.

I have a backend API workflow on a list that has several values structured as follows:

  1. looks up a Google Place ID by searching for place name and place city
  2. looks up Google Place details by the Place ID

Basically, for every detail that I want to look up from the Google API, I have 2 API calls. Given that I want to look up multiple details per row and I have multiple rows per request, this is quite significant, as it also slows down the app and increases cost. Ideally, I’d be looking up the Place-ID only once per row. Does anyone with a similar issue or a solution approach?

Thank you as always!


Hey @a.villabruna :wave:

Yeah. I can see how that would be a good idea. In the API connector. Duplicate the call you want ‘Google Places Search’ and make the new one an ‘Action’ instead of ‘Data’. Then you can do the call in step 1 as an action and use the data from there in step 2. Everything would just be ‘Result of step 1’.

As an alternative, you can setup your database to save the whole body of the Google places search in one field and then refer to that instead. But, I think the other option takes less rework for you. :blush:

Does that make sense?

1 Like

However, be careful with built in bubble duplication of api’s. I find it’s better to make a new one and copy stuff over as I’ve run into multiple bugs with their API copying stuff.

1 Like

I’m pretty confused about what you are trying to achieve and why you are needing two API calls to get all every detail.

Questions:

  1. When looking up the Google Place ID, are you running an API call for ‘find places’ or are you searching your database?

What rows are you referring to? If this is a backend workflow, there are no rows…if this is in a repeating group than there are rows, but you have not shared any screen shots or details regarding how your repeating group is set up.

In which ways are you experiencing a slow down? Is this in regards to a backend workflow, or a repeating group displaying the values?

How have you experienced the costs increasing? Is this because you are running the API call twice?

Again, what rows? A row within a repeating group?

Yes, but I’d need more details to understand what you are trying to accomplish and your actual current setup (ie: is this a backend workflow or a repeating group situation)

In my app, and in my experience with the Places API, I use the Get details call ONLY ONCE to capture ALL of the details, since you do get ALL of the details with a SINGLE call…there is nothing inherent about the Google Places API that would necessitate two calls for the same place to capture all of the details.

So, once I capture the Place ID all of the locations that I am wanting to get the details of, I can do a variety of things, depending on what I am trying to accomplish.

In my API connector setup, I always use the ACTION rather than data, since any API call that is an ACTION can have the data displayed in a repeating group or saved into the database, plus be used in a workflow action, whereas when it is set as data in the API connector, it can only be displayed in a repeating group, saved to the database but not used as an ACTION. I also, never double up on the calls (ie: make one action and another a data) because for me that just confuses me when selecting the appropriate data type to display in a repeating group as you will not see any differentiator between the data types.

In my app, I have a series of backend workflows that I run after I capture the place ID…I use the get details call to get the details, get image call to get all images and get reviews call to get the most recent 5 reviews (max provided by Google). I setup a recursive backend workflow using the list of Place IDs I want to capture details of.

First backend workflow will run to capture the place details, then I trigger another recursive backend workflow to capture the images, then another recursive to capture the reviews, then another recursive to capture the operating times, then a single action workflow to get a static map image, then trigger the first recursive in the series to capture the next place ID details…This runs smoothly and allows me to capture details of about 1,500 places each day.

The trick is to ensure you pass the appropriate parameters between the backend workflows, which includes for each the list of place IDs…and as you take each backend workflow off the list (I personally add the ‘step #’ into the names to keep track) of workflows to be running in the series you reduce the number of parameters needed to pass through. So my 2nd backend workflow requires 20 parameters to be passed through ( all of which are a list except two of them ), then my 3rd backend workflow requires only 11 parameters to be passed through, because the 2nd backend workflow already captured the details of the other 9 parameters (things like the reviewer name, profile image as well as the review details).

It is basically do a series of recursive backend workflows that are essentially combining to create one big recursive backend workflow series.

1 Like