Call REST (GET) - Microsoft Graph API - Illegal Character in Query

0
Hello everybody,    I am currently trying to call a REST (GET) service from the URL :  https://graph.microsoft.com/v1.0/users?$search="displayName:{2}"&$orderby=displayName&$count=true   Following connector problem is showing up: com.mendix.modules.microflowengine.MicroflowException: Illegal character in query at index 47: https://graph.microsoft.com/v1.0/users?$search="displayName:enes"     at MicrosoftGraphModule.GetAzureData (CallRest : 'Call REST (GET)') Advanced stacktrace:     at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:83) Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 47: https://graph.microsoft.com/v1.0/users?$search="displayName:enes"     at java.base/java.net.URI.create(URI.java:883)     at com.mendix.http.HttpLocation.toUri(HttpLocation.scala:33)     at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:60)     at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:39)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.$anonfun$execute$1(MicroflowObject.scala:32)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.scala:29)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.$anonfun$executeAfterBreakingIfNecessary$2(MicroflowImpl.scala:167)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.scala:167)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.scala:114)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:48)     at com.mendix.core.actionmanagement.internal.InternalCoreAction.call(InternalCoreAction.scala:25)     at com.mendix.basis.actionmanagement.ActionManager.$anonfun$executeSync$2(ActionManager.scala:80)     at com.mendix.util.classloading.Runner.withContextClassLoader(Runner.java:19)     at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.scala:79)     at com.mendix.basis.actionmanagement.MicroflowCallBuilderImpl.execute(MicroflowCallBuilderImpl.scala:38)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.runMicroflow(ExecuteMicroflowAction.scala:76)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.$anonfun$apply$3(ExecuteMicroflowAction.scala:42)     at com.mendix.webui.actions.client.RegularClientAction$Helpers$.$anonfun$liftEither$1(RegularClientAction.scala:29)     at com.mendix.webui.actions.client.RegularClientAction$Helpers$StateHandler.$anonfun$apply$4(RegularClientAction.scala:55)     at com.mendix.webui.requesthandling.helpers.StateHandling.withState(StateHandling.scala:42)     at com.mendix.webui.requesthandling.helpers.StateHandling.withState$(StateHandling.scala:39)     at com.mendix.webui.actions.client.RegularClientAction$Helpers$StateHandler.withState(RegularClientAction.scala:45)     at com.mendix.webui.actions.client.RegularClientAction$Helpers$StateHandler.apply(RegularClientAction.scala:53)     at com.mendix.webui.actions.client.RegularClientAction$Helpers$StateHandler.apply(RegularClientAction.scala:45)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.apply(ExecuteMicroflowAction.scala:43)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.apply(ExecuteMicroflowAction.scala:22)     at com.mendix.webui.actions.client.RegularClientAction.$anonfun$execute$3(RegularClientAction.scala:109)     at scala.util.Try$.apply(Try.scala:210)     at com.mendix.webui.actions.client.RegularClientAction.$anonfun$execute$2(RegularClientAction.scala:109)     at com.mendix.webui.actions.client.RegularClientAction.$anonfun$execute$2$adapted   I already did try to solve the issue with using urlEncode but it still doesn’t work properly. Now this error shows up: com.mendix.modules.microflowengine.MicroflowException: Error calling REST service     at MicrosoftGraphModule.GetAzureData (CallRest : 'Call REST (GET)') Advanced stacktrace:     at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:79) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: java.security.PrivilegedActionException: org.apache.http.client.ClientProtocolException     at com.mendix.integration.util.PrivilegedUtil$$anonfun$withPrivileged$2.applyOrElse(PrivilegedUtil.scala:17) Caused by: java.security.PrivilegedActionException: null     at java.base/java.security.AccessController.doPrivileged(Native Method)     at com.mendix.integration.util.PrivilegedUtil$.$anonfun$withPrivileged$1(PrivilegedUtil.scala:13)     at scala.util.Try$.apply(Try.scala:210)     at com.mendix.integration.util.PrivilegedUtil$.withPrivileged(PrivilegedUtil.scala:13)     at com.mendix.http.LoggableHttpClient.execute(LoggableHttpClient.scala:26)     at com.mendix.http.HttpExecutor$.$anonfun$request$1(HttpExecutor.scala:15)     at scala.util.Try$.apply(Try.scala:210)     at com.mendix.http.HttpExecutor$.request(HttpExecutor.scala:15)     at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:73)     at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:39)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.$anonfun$execute$1(MicroflowObject.scala:32)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.scala:29)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.$anonfun$executeAfterBreakingIfNecessary$2(MicroflowImpl.scala:167)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.scala:167)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.scala:114)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:48)     at com.mendix.core.actionmanagement.internal.InternalCoreAction.call(InternalCoreAction.scala:25)     at com.mendix.basis.actionmanagement.ActionManager.$anonfun$executeSync$2(ActionManager.scala:80)     at com.mendix.util.classloading.Runner.withContextClassLoader(Runner.java:19)     at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.scala:79)     at com.mendix.basis.actionmanagement.MicroflowCallBuilderImpl.execute(MicroflowCallBuilderImpl.scala:38)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.runMicroflow(ExecuteMicroflowAction.scala:76)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.$anonfun$apply$3(ExecuteMicroflowAction.scala:42)     at com.mendix.webui.actions.client.RegularClientAction$Helpers$.$anonfun$liftEither$1 Can somebody please help me out here?   Thanks in advance!   Best regards, Enes
asked
3 answers
1

Does it work when you replace

"

by

%22

 

answered
0

Do you have spaces in your rest call perhaps? Try replacing spaces with %20 (url encoded space character). Also add a http header → (ConsistencyLevel: eventual). This is required as far as I know in filtered graph api calls.

answered
0

You aren’t using safe characters in your URL. As Joost mentions, “ needs to be %22.

Mendix provides the urlEncode that you can use to correctly encode the values of your parameters if you need to use them in a URL.

https://docs.mendix.com/refguide/string-function-calls#urlEncode

Hope this helps.

answered