Interesting thing I discovered, which I do not think is properly documented: It is possible to configure an API call that has a variable path by using a “keyless” parameter.
It’s probably not obvious what I’m talking about. Consider the following Twilio API call: The Twiilio “Lookup” API is a simple API with one GET method that returns information about a given phone number. It has the following general form:
https://lookups.twilio.com/v1/PhoneNumbers/{phone_number_to_lookup}
On the face of it, this API call seems impossible to set up in Bubble. {phone_number_to_lookup} is not an argument… It’s just part of the path to the call.
But it turns out that if you define what I can only term a “keyless” parameter, Bubble handles this just fine. Here’s the example showing how to configure:
You’ll see that, instead of having a parameter name in square brackets (like [some_parameter]
), I’ve just used a space to create a keyless parameter ( [ ]
). When you do this, you still get a Key/Value pair in the “URL parameters” section of the configure call dialog, but Bubble takes the Value and appends it to the path, rather than trying to set a key with no name (which would make no sense).
So this configuration GETS the response from URL:
https://lookups.twilio.com/v1/PhoneNumbers/8005551212
And, in edit mode, if that keyless parameter is not set to private, we can change it (and this value can be dynamic of course):
So, in an API Connector URL represents a path, rather than an argument with key/value pair. (Even if this is documented, it’s the sort of thing that one would easily overlook!) Note that it is important for the character sequence to be left_bracket space right_bracket
. A pair of brackets without the space is not interpreted as path.
Neat.