How would I generate multiple params with the same name?

I am working with an API in development. In the process, something unusual just showed up…

There is a combo box used to pass as a text string to the API in order to filter search results. This was just updated to allow multiple items. However, in order to do so, I need to pass the same variable over in the string (in this case I have 9 possible options). So potentially, I would have to pass the same param 9x.

I was converting the variable I reference for this in bubble from a text to a list of texts. However that is passing the information as a single param with a list.

To follow the example I am linking to: ?id=1,2,3
The API wants me to structure it like this ?id=1&id=2&id=3

Is this even possible?

Add ?[params] to the end of the endpoint URL

Then you’ll have a new single parameter to fill in called “params” then do what you did before where it’s a list of texts, do :format as textmanually type “id=” then add This text and put & as the delimiter

So your list you provide goes from 123,abc,456 toid=123&id=abc&id=456

1 Like

This worked like a charm. It was even quite complex to setup as I didn’t mention in the prior post, I had 2 sets of variables to handle like that. So I had to setup the query params:

htttp://api.location/api-name/search?[param1]&[param2]

Before going too far I tested it and it was able to build the call correctly even if no vars passed through param1. I was worries the query string would look like this: search?& and it would be an issue but I guess not.

Incidentally, I am realizing that it is very hard to see the actual string the api connector generates. I don’t have server side metrics on this one, I would really like to see the construction of the api string I am sending out. I looked in the debugger but I am not sure if it tells you this data. Clicked zoom into the workflows and can’t track down the detail I am looking for. Is there a good way to debug api calls that are triggered inside of bubble?

Thanks again, this one really helped out today!

1 Like

:thinking: It should be visible in the server logs, have you click Advanced and checked the boxes to show API requests and everything?

Replace the delimiter with a , then close out of the window and do :split by , then do :merged with and do the same thing again with your 2nd list. Then after the whole thing do joined with "&"