I suspect you are using string manipulation to build the URL. If you are, you need to use urlEncode on any parameter values you are using, not on the entire URL.
Hope this helps.
Hello, I tried encoding the URL as follows:
the link that works perfectly in Postman:
http://localhost/***/odata/RndvSc?$filter=LC eq 1000006 &$orderby=CREATION_DATE desc
the link after the encode:
http://localhost/***/odata/RndvSc?$filter=LC%20eq1000006%20and%20$orderby=CREATION_DATE%20desc
Error:
com.mendix.webui.WebUIException: Exception while retrieving data for a widget 'MyFirstModule.Samples_Overview.grid1' on page 'MyFirstModule.Samples_Overview'
at com.mendix.webui.actions.client.RetrieveAction.$anonfun$apply$3(RetrieveAction.scala:92)
Caused by: com.mendix.modules.microflowengine.MicroflowException: Error calling REST service
at MyFirstModule.ImportSamplesREST (CallRest : 'Call REST (GET)')
Advanced stacktrace:
at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:79)
Caused by: com.mendix.modules.microflowengine.MicroflowException: 400: Bad Request
at MyFirstModule.ImportSamplesREST (CallRest : 'Call REST (GET)')
Hey Rares and Alexa,
In first example i’m seeing Creation Date with Single quotes in the 2nd I do not.
The encode actually forces a 400 bad request which means it’s invalid.
However IF the single quotes should be included at CREATION_DATE then you might want to add %27.
Which would be (Encoded): http://localhost/***/odata/RndvSc?$filter=LC%20eq1000006%20and%20$orderby=%27CREATION_DATE%27%20desc
Edit:
Based on below reaction, you should go with the Encoded URL since the Request does hit the server and your URL parameters or data is wrong (bad request, 400)
The Illegal character would therefor be ‘ fixed’ . Please check your request to make sure it matches postman correctly.
And I would also to suggest to use HTTPS for integrations since it makes it more secure than the default HTTP
Hello,
Thank you for answering!
CREATION_DATE shouldn’t be with quotes, it was something that we tried just to see what happens, sorry for the confusion!
We tried with the same link used in Postman (http://localhost/***/odata/RndvSc?$filter=LC eq 1000006 &$orderby=CREATION_DATE desc) but it gives the error that Rares posted in the first message with the illegal character.
Error:
com.mendix.webui.WebUIException: Exception while retrieving data for a widget 'MyFirstModule.Samples_Overview.grid1' on page 'MyFirstModule.Samples_Overview'
at com.mendix.webui.actions.client.RetrieveAction.$anonfun$apply$3(RetrieveAction.scala:92)
Caused by: com.mendix.modules.microflowengine.MicroflowException: Illegal character in query at index 44: http://localhost/***/odata/RndvSc?$filter=LC eq 1000006 &$orderby=CREATION_DATE desc
at MyFirstModule.ImportSamplesREST (CallRest : 'Call REST (GET)')
Advanced stacktrace:
at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:85)
From my understanding the error points to the 44 character which is a space right after http://localhost/***/odata/RndvSc?$filter=LC we also tried to replace spaces with %20 ( http://localhost/***/odata/RndvSc?$filter=LC%20eq1000006%20and%20$orderby=CREATION_DATE%20desc ) and we receive this error:
com.mendix.webui.WebUIException: Exception while retrieving data for a widget 'MyFirstModule.Samples_Overview.grid1' on page 'MyFirstModule.Samples_Overview'
at com.mendix.webui.actions.client.RetrieveAction.$anonfun$apply$3(RetrieveAction.scala:92)
Caused by: com.mendix.modules.microflowengine.MicroflowException: Error calling REST service
at MyFirstModule.ImportSamplesREST (CallRest : 'Call REST (GET)')
Advanced stacktrace:
at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:79)
Caused by: com.mendix.modules.microflowengine.MicroflowException: 400: Bad Request
at MyFirstModule.ImportSamplesREST (CallRest : 'Call REST (GET)')
Hey guys!
I found the correct answer, I will post it below. Thanks to everyone for your suggestions and answers! have a good day!
http://localhost/GIL/odata/RndvSc?$filter=LC%20eq%201000006%20&$orderby=CREATION_DATE%20desc
Hey guys!
I found the correct answer, I will post it below. Thanks to everyone for your suggestions and answers! Have a good day!
http://***/odata/RndvSc?$filter=LC%20eq%201000006%20&$orderby=CREATION_DATE%20desc