Build api URL using list of query params

Hi all,

I'm working on a API call where I have multiple queryparams with the same name,

e.g. baseurl/filter={filter1}&filter={filter2}&filter={filter3}

Is it possible to build a URL like this

baseurl/{filters} where filters = "filter=1&filter=2&filter=3"

 with the same functionality?



Hi Fábio,

Are you consuming a REST API that has this query parameters, or do you want to expose a REST API that does this? I've never seen a REST API that allows multiple query parameters with the same name, so it's a very odd way of passing parameters.

You cannot directly do what you propose, as the Platform will encode the "filters" parameter, so the = and & will be encoded (and the receiving end will not recognize it). There are work-arounds, but if you are trying to expose the API, please consider not doing it this way.


I'm consuming the API.

I did some research and found this: . Beside the Spring part in this article, the sending URL is exactly what I need.

If "filters" were "1,2,3" instead of "filter=1&filter=2&filter=3", I would have the same encode problem?


If it were "1,2,3" you wouldn't have that problem, as commas are allowed. I don't see a simple way to handle this, but I would probably handle it using an OnBeforeRequest, passing a Text List for the filter values, and creating the filter query parameters in the OnBeforeRequest. 

Hi Fábio,

According to this article it is possible, but it depends on your API. If it receives the parameters in "value=1&value=2" or "value=1,2". But I confess that, this way of passing parameters to an http call doesn't seem to be a good practice for me, I've never seen anything like it.
My advice is, if this API has a sand box, try these different forms.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.