Where to view response from POST call

I’m making a POST request to a 3rd party API. Per their documentation, they return a response with data that I would then use for further actions. Where can I view this response in my app? There’s no place in the POST call where I would specify an API endpoint in my app to receive their response. How or where can I view the returned response so that I can extract the info I need?

Thanks in advance,

It depends on whether it is a DATA or ACTION type API Connector.

Sounds like you want to make the call in a Workflow, which means you can then store the response.

But you can also use it to display the response on the page, so call the API in DATA mode and return the response to the page as text.

If you have initialised the API first, you will be able to pull out the elements into Bubble data types and display them.

1 Like

I use the call in a workflow so I’ve set the call as an ACTION type. How do I store the response? I don’t want it in my database. I just need to temporarily store it so that I can use the data from the response for further actions. Is there some way for me to export or copy/paste the raw response that I see after I initialize the call?

1 Like

The only places I can think of to put data, other than the database:
the page URL
a custom state
one of the elements

If you want to use the response multiple times then just refer to the API each time in the workflow.

Bubble doesn’t do a call each time, so you can pull out bits as you want.

3 Likes

@NigelG - So we can store multiple response objects by using the “Get Data from external API” in multiple Thing fields? For example if I am storing a response in the fields below, Bubble will only do one API call for this workflow action?

Is this correct?

Thanks Nigel

It is difficult to tell from that image.

What I meant was … if you have a workflow with multiple actions that all refer to an API call - so 1. Save thing 2. Modify another thing 3. Link 2 to another thing… it would seem that Bubble only does the API call once, and then uses the data multiple times.

I can now confirm that if one creates (or modifies) a Thing and uses “Get Data from external API” in multiple fields…Bubble will in fact call the API multiple times. Essentially, we are only able to save one response object from a POST. As a current hack, when I create/modify a Thing using response data from a POST, I save the unique identifier from the POST action (if there happens to be one) and then immediately initiate another workflow action (GET) to that same service to collects any additional information about the request (assuming that option is available with the API service).

1 Like

And yet …

Which is 4 calls to the same API in the same Workflow … and in multiple steps…

This has 1 hit on the API at the other end (the API just adds 1 to a counter and returns a text which is the counter value).

Even if I add another Create Thing using the same API … it only calls it once.

So I am seeing it as I previously stated. I wonder what rules Bubble is applying here to make this different ?

1 Like

Thought it might be the fact I wasn’t passing dynamic data, so added a parameter to my API call from an input. Still only 1 call.

So then I added two inputs, so the API is hitting two different counters on the other side.

And I split the API calls across two separate thing creations - and the counter is still preserved, so still just 2 API calls despite mixing up in workflow actions.

Well, that is certainly odd. After troubleshooting a webhook for hours, and using a combination of Postman and Request Bin, I figured out that it had to be two separate calls on my particular API service from Bubble during a “create a thing” workflow action, which returned two mismatched tokens (Token A1 and Token B1). This was causing an external webhook to return the two mismatching tokens into my Bubble endpoint (i.e. not returning the pair I needed to verify a user action…Token A1 and Token A2). By following the original POST with a GET request using Token A1 as a parameter (luckily my webhook service stores tokens in pair) and returning the correct match Token A2…it did not match Token B1 that Bubble that stored along with A1.

Original Scenario:
Bubble generates A1 & B1…webhook returns A1 and B1 after user action to my endpoint…my endpoint dismisses it as invalid.

Modified Scenario of using a POST to get A1…then following with a GET to get A2:
Bubble generates A1…retreives A2 and stores it with A1…webhook returns A1 and A2 after user action…my endpoint accepts the pair and initiates a workflow.

Perhaps @emmanuel could chime in and help clear things up for us.

Yes, something is odd for sure :slight_smile:

I have even tried to get my parameter from another API. So my workflow calls an API to get some text, it then uses that text in another API call to retrieve the counter. Despite the fact the first API could return different values each time (i.e. Bubble is not in control of the return data) it still just does the single call each time.

Hopefully, Emmanuel can shed some light.

Can you reformulate the question? It’s hard to help out of context.

My observed behaviour of having an API Connector call used multiple times in a Workflow, across multiple steps, is that Bubble aggregates these calls rather than does a new one each time.

Example. Create a thing …

field1 = call API1 store a text
field2 = call API1 store a number
field2 = call API1 store a text

Step 2. Update a field using the same API1
Step 3. Create a new thing using the same API1

Looks like you just do the API1 call ONCE rather than for each field/action.

However there seems to be a situation where you do multiple calls, which is what @supernaturally is seeing, which is very different to what I am seeing.

Can you tell us what the rules of this API aggregation are please ?

If the call parameters are the same, there is only one call that is made (and we cache the result) .

3 Likes

I know this is a very old post, but just a suggestion to add this point (that Bubble caches API responses to allow updating multiple fields without making multiple identical API calls) to Bubble’s formal reference manual somewhere. For APIs with call limits, I was concerned that I was blowing through calls at 5x+ the necessary rate. Great to know that Bubble handles these efficiently. Thanks!

2 Likes

@emmanuel: is there any way to force bubble NOT to cache a call’s result?!
I am getting “live information” (via POST), so the call is always the same - but the return never is!
Currently this is preventing me from finishing my project :confused:

Any help / hints greatly appreciated!

Danny

You must have set up this call in the API Connector, right?

Well, this call you have defined is either an Action or Data type call. If youve defined it as an action, the return values you’ve defined in the API Connector are available as “Result of step…” in your workflow.

If Data, you do a Create or Modify a thing and the values for the fields in that thing are expressions you select as “get data from API”.

1 Like

You ensure the cache isn’t hit by making the parameters or headers or url different, for example current time : extract unix milliseconds.

1 Like