Microsoft Graph Rest API v1.0 --- HTTP GET Request
1
I’m trying to make a get request exactly like in the documentation below for exactly that use case: get the users that contain some letter eg. ‘wa’ https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http#request-body I get the following error: {"error":{"code":"BadRequest","message":"Syntax error: character ':' is not valid at position 11 in 'displayName:wa'.","innerError":{"date":"2022-01-05T20:33:23","request-id":"69208953-3831-4d35-890a-53301705a487","client-request-id":"69208953-3831-4d35-890a-53301705a487"}}} Also, I’ve been trying to use a $filter with contains like this for example: from : https://stackoverflow.com/questions/55359070/microsoft-graph-mail-search-strict-value But as somebody suggests: in the doc it says : "The contains string operator is currently not supported on any Microsoft Graph resources" UPDATE: Error message: Illegal character in query at index 47: https://graph.microsoft.com/v1.0/users?$search="displayName:'wa'"&$select=displayName,givenName,postalCode,jobTitle,mail,mobilePhone,officeLocation,usageLocation,userPrincipalName,city,country,department,surname,displayName Illegal character in query at index 47 is “=” but I don’t understand what’s wrong about it :( :( :( Simplified HTTP link ---> Illegal character in query at index 47: https://graph.microsoft.com/v1.0/users?$search="displayName:wa" Also tried like this with --- 'wa' ---: Illegal character in query at index 47: https://graph.microsoft.com/v1.0/users?$search="displayName:'wa'" Tried using encoded URL directly in HTTP request in mendix microflow: https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%3F%24search%3D%2522displayName%3A%2527wa%2527%2522%26%24select%3DdisplayName%2CgivenName%2CpostalCode%2CjobTitle%2Cmail%2CmobilePhone%2CofficeLocation%2CusageLocation%2CuserPrincipalName%2Ccity%2Ccountry%2Cdepartment%2Csurname%2CdisplayName Got the following error: Stacktrace: Error calling REST service at A3Creator.WEB_Get_UserList_ForUserSearchHelper (CallRest : 'Call REST (GET)') at A3Creator.ACT_SearchUserFromContactBook_AdvancedSearchFilter (SubMicroflow : 'WEB_Get_UserList_ForUserSearchHelper') Advanced stacktrace: at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:65) Caused by: java.security.PrivilegedActionException: org.apache.http.client.ClientProtocolException at com.mendix.integration.util.PrivilegedUtil$$anonfun$withPrivileged$2.applyOrElse(PrivilegedUtil.scala:17) Caused by: null at java.base/java.security.AccessController.doPrivileged(Native Method) at com.mendix.integration.util.PrivilegedUtil$.$anonfun$withPrivileged$1(PrivilegedUtil.scala:13) Error message -→ “Target host is not specified”
asked
Marcian-Petrut Bondoc-Popescu
2 answers
2
It looks like you're using a single quote instead of a double quote before and after the display parameter.
What usually helps is to set the request URL in a string variable, so you can debug and see what URL is being called . In string concatenation, using quotes often goes wrong the first time :) . You need to escape single quotes with an extra quote.
Can you post the string that is created and called in the rest action?