Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tRest using OData URL with blank space

Hello,

I have an issue using tRest component to send an OData query, with a filter like "CFISCYEAR eq 2018" in my URL because of the blank spaces.

 

My URL is like :

"https://myaccount.mysite.com/myreportQueryResults?$filter=CFISCYEAR eq 2018&$select=CFISCYEAR,CPROJECT,CPROOBJECT"

All is working fine without the red part filter=CFISCYEAR eq 2018Because of the spaces I have in this filter, I get a java.lang error : IllegalArgumentException: Illegal character in query at index XX.

 

It's not not working even after encoding the URL to UTF-8 with URLEncoder, as I get the following error : 

com.sun.jersey.api.client.ClientHandlerException: java.lang.IllegalArgumentException: URI is not absolute

 

Thanks in advance for your precious replies :=)

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thanks, I resolved it.

I replaced the blank space with %20, and it worked.

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Thanks, I resolved it.

I replaced the blank space with %20, and it worked.

Anonymous
Not applicable
Author

This is combination of issues. I'll explain. First of all, you DO need to use the URLEncoder but just for certain parts. You *can* just replace those parts if you are hardcoding the URL, but URLEncoder is probably best to use. You do NOT need to encode the code in green, you DO need to encode the code in red .....

 

"https://myaccount.mysite.com/myreportQueryResults?$filter=CFISCYEAR eq 2018&$select=CFISCYEAR,CPROJECT,CPROOBJECT"

 

It is all to do with safe, reserved and unsafe characters. It is described here reasonably well (https://perishablepress.com/stop-using-unsafe-characters-in-urls/).

 

The reason you hit the second problem is that you encoded the whole thing including the https://. That is why you got the second error.

Anonymous
Not applicable
Author

That may have fixed your issue, but it is not the solution if other people hit the same problem. Your spaces were the only illegal characters in this URL. However any of these used as data would cause issues....

 

; / ? : @ = &" < > # % { } | \ ^ ~ [ ] `

Anonymous
Not applicable
Author

Hello ! Could you tell us please how did you deal with authentification token for ODATA querry ?