How to detect error in API Call in workflow


How would I detect the response of an API Call in a workflow? I am using the bulk insert method like this:
As a next step I’d like to create a log if the result of this step had an error.
I was thinking something like “Result of step 1” contains an error. I am assuming I would have to use regex? Does anybody have an example on how to detect if the previous step resulted in a success or error?

Many thanks in advance!

What’s the api? Depending on the api, some send back a success is true or false after it’s been run for the response body.

I have many different APIs and they do send back status, such as 200 for success. What I don’t know is how to check for that in Bubble.
As an example, here I insert my data, but on the 2nd step I would like to add a condition only if the results of step 1 was success

While I could run the same API Call again and then get the status value, I was hoping there was a more elegant way

1 Like

Maybe I’m missing something. Why don’t you store the 200 response as a yes / no in your database. insert when response is “200” you perform the make changes to integrations settings. It’s more work but I think that is the simplest way.

I think you are on the correct path, I have my API calls and then the next step has a conditional that only runs if Step 1 has no error. Here is what it looks like.

I actually like to have another step with a conditional that shows a message to the user if Result of Step 1 returned an error is “yes”

That’s what I was looking for, but I don’t have anything but the default action items to chose from. There is nothing that would reference an error to chose from.

When you create the API call in the API connector, look at what gets returned.
So when I do a post, this is what gets returned:

Screen Shot 2023-03-01 at 1.37.12 PM

You can map those fields just like when you make a GET - easiest to do when you initialize the call the first time.
Then Bubble will let you access for example “Returned an Error”
Bubble will probably default that field to return type text, I change it to Boolean.

I don’t know if it helps somehow. Please check. How to Use the Unhandled Error Occurs Event | Bubble

I am not sure this will help, but that was a great tip. Thank you. I am still new to bubble (less than 3 months) so there is a lot to learn.