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.
-Steve