Send 2 query parameters with the same name

HI

an snippet from the docs of the API I use

Multiple filters

Filters can be applied by repeating the “filter” parameter in the URL. For example, the following URL:

GET /records/categories?filter=id,gt,1&filter=id,lt,3

when I do that, only the 2nd parameter is sent

image

even if I disable the function.

image

Is there any tip how to send the parameter twice?

Logfile

Thanks Rob

when i switch this one on i still only get the second parameter

image

i would expect an array then

?filter[1]=uuid,eq,54dd6e8c-6d43-48a9-ad3d-a65339394199
&filter[2]=type,eq,sample

But still only the 2nd parameter is sent

why?

I’m not sure this will work because the second filter will replace the first in the query param. A url can only have a unique set of query parameters.

Why can’t you create the necessary expression in just one filter parameter by combining the logic?

HI Alex

Please Look at the foo example - it is directly out of make http request

By default, Make handles multiple values for the same url query string parameter key as arrays (e.g. www.test.com?foo=bar&foo=baz will be converted to www.test.com?foo[0]=bar&foo[1]=baz ). To disable this feature, activate this option.

“Disable serialization of multiple same query string keys as arrays” is ON

Why they only send the LAST key ?

It’s quite commen (I think) to use the same parameter twice as they also do in there own example
www.test.com?foo=bar&foo=baz - foo gets 2 values …

It looks like a bug to me :frowning:

cu rob

Does it work if you just put the parameters in the url directly instead of using the query strings fields?

1 Like

good idea . i put both parameter in 1 field but i had problems with the & (encoded) but i will try your solution and report - thanks

NO it is not working - looks like the URL is trimmed before the Query String is added

only get

“GET /records/exam_sets/?filter=uuid%2Ceq%2C54dd6e8c-6d43-48a9-ad3d-a65339394199 HTTP/1.1” 200 39689 “-” “Make/production”

mhh but thanks anyway rob

@trob999 did you also test out the API calls within Postman to make sure its not an API issue?

1 Like

Yes Postman response is OK - Exact what I expect - also both parameters in th APi Server Logfile. Since MAke is (according to the apach logs) not sending the right URL the response i s wrong
make is not adding the second Parameter…

also when i swicth OFF "Disable serialization of multiple same query string keys as arrays”
The URL is not modilated correctly !!! that is why i guess it is a bug

Hey @trob999 , its a bit of a weird API (looks like oData but at the same time is not) however this does indeed seem like a bug…
Could you create a support ticket with the team, since they will be able to assist you more.

Let us know how that goes!

2 Likes

I still think that Make is not sending it correctly - so the API I am using is not important - I could use another API and see what it receives

I expect to see the following in the WAHTEVER API server log files.

  1. Version with ARRAY - serialization OFF
    www.test.com?foo[0]=bar&foo[1]=baz

  2. Version without Arry - serialization ON

www.test.com?foo=bar&foo=baz

But make sends only in BOTH cases

www.test.com?foo=baz

Which IMHO is a bug !

I will ask our expert next week as I have a workaround for the weekend
cu rob