Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

REST URL request and square brackets ('[' and ']')

I would like to know if square brackets ([ and ]) are standard in REST URL parameters.

  1. I have to call a Cloud REST WebService by settings all parameters in the URL. The URL looks like: https://DNS_SERVEUR/api/2/conversation?filters[website]=1234&data=a0123....

    You can see that one parameter's name contains square brackets: filters[website]

  2. Calling the URL directly with Firefox or SOAP-UI does not raise any issue (they do not crash on square brackets).

    However, using Oracle Fusion Middleware 12.2.1.1.0 and dedicated REST adapter, I have an error: square bracket characters are not allowed in parameter name.

So here is my question: Can square bracket characters ([ and ]) be used as standard REST URL parameters? Or is it a limitation in Oracle Fusion Middleware?

I searched on the Internet and did not get any clear answer. The only example (in French) using it is to manipulate associative array in PHP: http://cyberzoide.developpez.com/php4/url/#LII-E. As PHP is very permissive, I do not take it has a reliable reference for standard.

like image 945
ymir Avatar asked Oct 28 '25 01:10

ymir


1 Answers

RFC 3986 should be the go-to for understanding what is allowed in the query of a URI.

query       = *( pchar / "/" / "?" )
pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

Hook characters are gen-delims, not sub-delims

gen-delims    = ":" / "/" / "?" / "#" / "[" / "]" / "@"

So they should be encoded when appearing in the query part.

See also https://stackoverflow.com/a/2375597/54734

like image 136
VoiceOfUnreason Avatar answered Oct 31 '25 13:10

VoiceOfUnreason



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!