What is the best way to accept User Input and then pass a fully formed URL to an API?

It sounded like you were trying to call an API endpoint completely dynamically (which I don’t think you can do).

If you have some parameter that’s supposed to be a fully-qualified URL, and you want to ensure the protocol part is there, take your input’s value, strip off any protocol using the regex value (^\w+:|^)\/\/and pre-pend https://. In Bubble, that expression looks like:

https://some_value:find and replace (replace that regex with nothing)

LIke so:

Any text field can do this (like your field for your parameter), but here’s an example in a standard text element:

Runtime: Works whether we leave off the protocol:
image

Specify the protocol correctly:
image

Or do something dumb:
image

image

You could further refine that if desired, but “how dumb do you expect your users to be?” is the question when doing stuff like this.

1 Like