Ask a Question

[Res]duplicate properties in REST request

sbeauvais
Contributor

[Res]duplicate properties in REST request

Hello,

How to I configure a REST method/request to have duplicate properties, e.g.,

GET /dev/api/calendar/locations?locationIds=96&locationIds=33&startDate=01-Feb-2014&endDate=28-Feb-2014


As you can see, property "locationIds" is included twice.

If the REST method/request cannot be configured to support this, can I build the GET command programmatically? I have tried to 'cheat' by setting the value of locationIds to "96&locationIds=33" but the ampersand and the equals symbols are replaced by their code (even though I tried to entitize them).

So, is this possible to do, and if so, how?


Sincerely,
Séverin B.
14 REPLIES 14
sbeauvais
Contributor

I found out that I'm trying to pass an array of values.

Found this in a new search: viewtopic.php?t=6882
SmartBear_Suppo
SmartBear Alumni (Retired)

Hello,

Did the above link work for you, or are you still having issue?

Regards,
Temil

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
sbeauvais
Contributor

Hello,

The linked post refers to "a property for setting this", but I cannot see the nightly build changelog.

Can you please expand upon the various options for setting and controlling multiple values for a parameter?

Can I assign multiple values to a parameter using a properties transfer or Groovy script, and if so, how?

(Or please point me to any existing documentation / web page on this topic... I searched but found nothing.)


Thx.
Severin B.
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi,

You can add multiple parameters with same name.
You can specify the parameter with a | character.
so locationid[] para1|para2|para3

Thanks,
Jeshtha

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
sbeauvais
Contributor

Hi Jeshtha,

Thanks for your reply.

Can you tell me where I specify the multiple parameter? Do you have a screenshot?

I created a DataGen that returns "96|44|4" but the request looks incorrect (and fails):
DEBUG:>> "GET /dev/api/calendar/locations?LocationId=96%7C44%7C4&StartDate=01-JAN-2014&EndDate=31-AUG-2014 HTTP/1.1[\r][\n]"



Cheers,
Severin B.
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi,

You need to disable encoding for that parameter,
For custom encoding handling when setting a parameter value (the “Disable Encoding” setting)

http://www.soapui.org/REST-Testing/rest-resources-and-methods.html#1-adding-rest-services-resources-...

Check the attached image.

Thanks,
Jeshtha

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
sbeauvais
Contributor

Thanks again Jeshtha.

What else do I need to do for the parameters to be correctly processed and sent?

I get this:
java.net.URISyntaxException: Illegal character in query at index 66: https://XXX.com/dev/api/calendar/locations?LocationIds=23|33|44&StartDate=01-JAN-2014&EndDate=31-AUG-2014


I would like to get this:
GET /dev/api/calendar/locations?locationIds=23&locationIds=33&locationIds=44&startDate=01-JAN-2014&endDate=31-AUG-2014



Severin B.
sbeauvais
Contributor

That's actually the Resource Definition, so all methods and requests below it are affected.

I worked around this by creating a new child resource for this.

The request now looks like this:
Mon Feb 24 14:07:39 PST 2014:DEBUG:Sending request: GET /dev?StartDate=01-Jan-2014&EndDate=31-Jan-2014/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/client/ HTTP/1.1


Is this a bug in SoapUI Pro 4.6.4? If not, what am I doing wrong?

SB
sbeauvais
Contributor

Here's a brand new project that displays the issue I'm referring to. (Endpoint/username/password are changed for security purposes.)

SB
cancel
Showing results for 
Search instead for 
Did you mean: