😃 Dynamic data - including lists - in body of API post requests - POSSIBLE!

Perhaps this is common knowledge and I’m just a little slow on the uptake, but I recently learned something that completely changed my understanding of the API Connector (and API tab of the plugin editor).

Just above the Body field, it reads…

  • Body (JSON object, use <> for dynamic values)

I had always thought it meant that angle brackets could be used only within the context of individual property values. However, it’s actually much more flexible than that!

What it really means is that angle brackets can be used anywhere within the body of the request and that any such bracket-enclosed text will appear as a field in the property editor so that its value can be specified using the dynamic expression builder.

So basically, Bubble simply runs pattern recognition and substitution on the entire body text field and converts all bracket-enclosed entities into dynamic expression fields in the editor!

What this means is…

The following API config…


…produces the following editor experience…


…which results in the following request body…


But it also means the following is perfectly valid…

That’s right. The entire body of the request can be constructed using a single dynamic expression! (…although the need for just a single field would probably be infrequent)

Anyway, coupled with the recent :formatted as text operator for lists, this means that literally anything - including dynamic lists and objects of arbitrary complexity - can be supplied as part of an API request body.

Perhaps this is old news to some, but it was an eye-opener for me.



1 Like

Hey @sudsy ! This was exactly the info I needed, thanks!

I have one question though, what did you put in the Value box of The List

in order to be able to initialize the API call in Bubble?

In my case, my list (lista_de_items) is a list of things. What can I put in the Value box in order to initialize my API call?

It just needs to be an array in valid JSON format. Just one item should suffice, but it has to be an array. In my case, it was an array of strings (Bubble Text types)…

["my string"]

In the real world, you might want to run each string in your JSON through the :format as JSON-safe operator.


Thanks for your reply!

Any idea of what should I type to initialize the call if it is an array of things (A Bubble datatype thing)?

Solved. Typing a unique id did the trick. Thanks!

1 Like

Amazing post - thanks

1 Like