When I create the get request with query parameter that contains the space then it automatically encoded as a + and not as %20. If any of the values of my query parameters have spaces in them, they will be automatically URL encoded on execution of the query. I am using REST API to call odata request.
In OData a plus character is used for expansion of child records and is treated as a special character. Is there any way that outsystem does not change the %20 or space to + sign?
Thanks
Sanjay kumar wrote:
Hi,
At first, I think a + sign should be %2B, not %20
Secondly, with REST api, OutSystems provides you the "On Before Request", you can implement things to prevent the conversion here
Hope this help
Shingo Lam wrote:
Hi Shingo,
thanks for reply me, Yes. I know %2B is + sign and %20 is space sign. and Odata accept the %20 as space And I wanted to say that when ever I used space or %20 in query parameter for example:
.../UserTodoLearningItems?$filter=criteria/includeDeeplink eq true OR
.../UserTodoLearningItems?$filter=criteria/includeDeeplink%20eq%20true
then OutSystem automatically change those to plus sign as you can seen in below image.
And regarding the "On Before Request", I have already tried it but I don't know how can I replace this + sign with space or %20 in "On Before Request"
I think you should check if the data you received in the "On Before Request" is correct. If not, please replace the + with space, else try to encode the url when call to the end point api
I can not see the + sign in "OnBeforeRequest" in Query parameter so that I can replace it. check the below image, the value of query parameter is still same in "OnBeforeRequest" so how can we get the generated request URL then we will know that final URL which OutSystem is requesting.
I see.
So you can try one of these:
hi,
Thanks for your responses, can you tell me how can I use JS to call the rest api.
Hello!
Did a satisfactory solution ever get found for this, as I am encountered them same issue.
In the "OnBeforeRequest" event, I translated the "space" characters to "%20", but when I look in the Integration Log in Service Center, I can see that OutSystems was still using "+" in the request it actually sent.
Timothy Case wrote:
Hi Timothy,
I could not find the suitable solution then I created extension in integration studio and used .NET to call the API and then it worked for me.
Sanjay Kumar
Outsystems seems to use different encoding for the URL and the variable values.
I added in the on before request the variable names and values to the end of the URL (url = url + "?" + var-name + "=" + varvalue in a loop and then cleared the list of vars.
This worked for me. Hope it helps someone else too.
Rgds,
Willem
I'm facing the same problem, and I couldn't resolve it with the default Rest API consumption. Therefore, I'm using the Forge below to address the issue.
ardoHTTP - Overview | OutSystems