Using data from one API call in place of another?

Hi - I have two API Connector requests that return the exact same data. One “gets the data” and saves it into a state, with the data type matching the “get” request.

A second one “updates, then returns the data”. I’m trying to use the result of the “update” request to update that same state, to avoid a second “get” request.

It seems like Bubble does not let me use the results of one API request to replace the data from another, even though the JSON structure is exactly identical. Is there any way to make this work?

Thank you!

Hey Byron -

I am just learning Bubble, and came across the same problem. I solved mine by consolidating multiple API Connector Calls into one Call for those that return the same data type. The key is to add another parameter in the call URL where you actually pass a portion of the API URL (which was different in the separate calls) to the connector as well as any other parameters.

Instead of just passing the parameters to the call, you also pass a portion of the URL route (or all of it). It completely fixed my problem - hope it helps.

Here’s a basic example of the URL and parameters in the API Connector setup:

BEFORE
CALL 1
https://www.site.com/api/ route1 & param1=[param1] & param2=[param2]
[param1]
[param2]
CALL 2
https://www.site.com/api/ route2 & param1=[param1] & param2=[param2]
[param1]
[param2]

AFTER
SINGLE CALL
https://www.site.com/api/ [route] & param1=[param1] & param2=[param2]
[route]
[param1]
[param2]

1 Like

Thanks @reddingmay for the reply! I was thinking of taking a similar approach as well…making my endpoints based on return data, and passing on additional prior “actions” as optional parameters. Was hoping for another way but, maybe this is the best we can do here. Appreciate your tips!