[New Features] API Connector

Hi everyone!

I’m excited to announce that we’ve just deployed several improvements to the API connector.

“Allow blank” option to parameters
There is now an “Allow blank” checkbox on API Call parameters. When this option is selected, the key value used to initialize the API Call will not be seen/accessible in the element or workflow property editor that is calling the API. This will allow Plugin or Bubble developers to optionally leave a default value in the API connector for initialization purposes without exposing it elsewhere in the app.

Raw (plain text) body format type
There is a new raw text option for an API call body, in addition to JSON and form-data. Selecting this option allows you to format the body of an API call in the body canvas in whatever format you’d like and specify the format type (ie XML) in a Content-Type Header.

API Call error handling
And, the moment you have all been waiting for (drum roll please…) - error handling for API Call responses!
There is a new checkbox called “Include errors in response and allow workflow actions to continue” that will allow you to handle api call error responses however you’d like. There are two parts to this feature. First, when this checkbox is enabled and your api call returns an error, Bubble will continue the workflow or action (as opposed to the current “fail silently” behavior). Second, we now expose the error object (e.g. "Result of Step 1's API Call's error") for use in a dynamic expression. The 4 parameters now available are error status_code, error status_message, error body, and error has_returned_error (yes/no).

As an example of whats now possible, consider the following scenario:

Let’s say I have an API call as the data source for an image element with some dynamic parameter. However, if this API call returns a 404 not found error, I’d like to display a default image instead. We can simply add a conditional to the image element When API - Get Image’s error StatusCode is 404, change data source to the default image.


The documentation will be updated to include more detail on the above three features as well.

We hope you are as excited for these new updates as we are and excited to see what you continue to build as a result!

70 Likes

image

Sir Lewis :+1: :laughing:

14 Likes

Great updates and explanations!

It’s not a shiny new update that attracts new Bubble users but all the power users notice and appreciate updates like this :raised_hands:

13 Likes

Yessssssss!! :star_struck:

I’m getting weird API behavior. Oauth sign-in seems to be broken and some other funky responses from previously-working endpoints :-/

Specifically, I’m getting the bubble white screen of death and a reason : bal on Oauth signin redirect not sure if related but I came to the forums to see if others were experiencing issues too and I saw the update. Not to detract from a very much needed feature upgrade though!

Hi Jon, sorry to hear you are experiencing issues. Do you mind filing a bug report so we can see if they are related / get this resolved for you ASAP? Thanks!

1 Like

Done!

Awesome updates, thanks!
Would it be also possible to consider the 308 response as a successful one when initializing the API call? Some API use this number instead of the common code 200.

Hey @nick.carroll,

I think it just broke Google Oauth on my live app
cannot read property 'wrap_error' of undefined

This is great! Love the XML support.

1 Like

hey @nick.carroll it seems that the update errased the option to add parameters to the call, the button to add parameters is missing …

any other way to add params programatically from bubbles components?

2 Likes

Do you mind filing a bug report so we have your app id? Thanks and sorry for the issue this is causing.

Oh wow, finally error handling is making it’s way in. Thank you guys.

5 Likes

Error handling - Nice! Massive win!

3 Likes

Hey all - temporarily rolling back this update to fix an issue that has broken Google OAuth2 flows. We will redeploy shortly with the fix and above functionality. Thank you for your patience and apologies for the bug :confused:

4 Likes

I am also seeing this for GET methods. It seems to still be there (when I use the api in the site) but not in the plugin settings

This is wonderful! I’m really excited to allow for empty defaults!

1 Like

This is awesome news! Finally we have a way to smoothly handle API errors.

2 Likes

These were unintentionally hidden, being resolved as we speak. Sorry and thank you!

4 Likes

Same for me. Cannot see the options to add parameters. I also create a post for this issue: Cannot set API filter in API connector