Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Getting Error Illegal character in query REST AddAccessJSON

prajakta
Regular Contributor
Regular Contributor

Hi, 

We need to perform 2 API calls in AddAccessJSON of REST connector. 

1. GET - https://graph.microsoft.com/beta/devices?$search="displayName:MachineName"

2. POST - https://graph.microsoft.com/v1.0/groups/groupID/members/$ref

The #1 API URL is not getting resolved. Following options are attempted 

1. "url": "https://graph.microsoft.com/beta/devices?$search=%22displayName%3A'${account.accountID}'%22",
[error:Error Illegal character in query at index 68:
https://graph.microsoft.com/beta/devices?$search=%22displayName%3A'${account.accountID}'%22]

2. "url": "https://graph.microsoft.com/beta/devices?$search=%22displayName%3A${account.accountID}%22",
[error:Error Illegal character in query at index 67:
https://graph.microsoft.com/beta/devices?$search=%22displayName%3A${account.accountID}%22]

3. "url": "https://graph.microsoft.com/beta/devices?$search=\"displayName:${account.accountID}\"",
error:Error Illegal character in query at index 49:
https://graph.microsoft.com/beta/devices?$search="displayName:${account.accountID}"]

Upon hardcoding the value for ${account.accountid} the API is getting invoked successfully. 

Kindly provide suggestions in order resolve this issue.

Thanks,

Prajakta

 

 

 

 

4 REPLIES 4

NM
Honored Contributor III
Honored Contributor III

@prajakta can you share prov logs?


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

prajakta
Regular Contributor
Regular Contributor

2024-10-23T14:19:02+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-12-m9725-DEBUG-Calling Webservice Url - https://graph.microsoft.com/beta/devices?$search="displayName:${account.accountID}" with httpParams - null
2024-10-23T14:19:02+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-12-m9725-DEBUG-Got Webservice API Response: [error:Error Illegal character in query at index 49: https://graph.microsoft.com/beta/devices?$search="displayName:${account.accountID}"]
2024-10-23T14:19:02+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-12-m9725-DEBUG-Got null response statusCode with erroMsg - [error:Error Illegal character in query at index 49: https://graph.microsoft.com/beta/devices?$search="displayName:${account.accountID}"]
2024-10-23T14:19:02+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-12-m9725-DEBUG-addAccessJSON: [call:[[name:Groups, connection:userAuth, url:https://graph.microsoft.com/beta/devices?$search="displayName:${account.accountID}", httpMethod:GET, httpHeaders:[Authorization:${access_token}, ConsistencyLevel:eventual], httpContentType:application/json, successResponses:[statusCode:[200]]], [name:Groups, connection:userAuth, url:https://graph.microsoft.com/v1.0/groups/${entitlementValue.entitlementID}/members/\$ref, httpParams:{"@odata.id":"https://graph.microsoft.com/v1.0/directoryObjects/${response.Groups.message.value[0].id}"}, httpMethod:POST, httpHeaders:[Authorization:${access_token}], httpContentType:application/json, successResponses:[statusCode:[200]]]]]
2024-10-23T14:19:02+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-12-m9725-DEBUG-params.memento.addAccessJSON : [call:[[name:Groups, connection:userAuth, url:https://graph.microsoft.com/beta/devices?$search="displayName:${account.accountID}", httpMethod:GET, httpHeaders:[Authorization:${access_token}, ConsistencyLevel:eventual], httpContentType:application/json, successResponses:[statusCode:[200]]], [name:Groups, connection:userAuth, url:https://graph.microsoft.com/v1.0/groups/${entitlementValue.entitlementID}/members/\$ref, httpParams:{"@odata.id":"https://graph.microsoft.com/v1.0/directoryObjects/${response.Groups.message.value[0].id}"}, httpMethod:POST, httpHeaders:[Authorization:${access_token}], httpContentType:application/json, successResponses:[statusCode:[200]]]]]
2024-10-23T14:19:02+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-12-m9725-DEBUG-currentEntitlementJsonMap : [call:[[name:Groups, connection:userAuth, url:https://graph.microsoft.com/beta/devices?$search="displayName:${account.accountID}", httpMethod:GET, httpHeaders:[Authorization:${access_token}, ConsistencyLevel:eventual], httpContentType:application/json, successResponses:[statusCode:[200]]], [name:Groups, connection:userAuth, url:https://graph.microsoft.com/v1.0/groups/${entitlementValue.entitlementID}/members/\$ref, httpParams:{"@odata.id":"https://graph.microsoft.com/v1.0/directoryObjects/${response.Groups.message.value[0].id}"}, httpMethod:POST, httpHeaders:[Authorization:${access_token}], httpContentType:application/json, successResponses:[statusCode:[200]]]]] | entitlementname: Groups
2024-10-23T14:19:02+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-12-m9725-DEBUG-currentEntitlementJsonMap : [call:[[name:Groups1, connection:userAuth, url:https://graph.microsoft.com/beta/devices?$search="displayName:${account.accountID}", httpMethod:GET, httpHeaders:[Authorization:${access_token}, ConsistencyLevel:eventual], httpContentType:application/json, successResponses:[statusCode:[200]]], [name:Groups2, connection:userAuth, url:https://graph.microsoft.com/v1.0/groups/${entitlementValue.entitlementID}/members/\$ref, httpParams:{"@odata.id":"https://graph.microsoft.com/v1.0/directoryObjects/${response.Groups.message.value[0].id}"}, httpMethod:POST, httpHeaders:[Authorization:${access_token}], httpContentType:application/json, successResponses:[statusCode:[200]]]]]
2024-10-23T14:19:02+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-12-m9725-DEBUG-params.memento.addAccessJSON: [call:[[name:Groups1, connection:userAuth, url:https://graph.microsoft.com/beta/devices?$search="displayName:${account.accountID}", httpMethod:GET, httpHeaders:[Authorization:${access_token}, ConsistencyLevel:eventual], httpContentType:application/json, successResponses:[statusCode:[200]]], [name:Groups2, connection:userAuth, url:https://graph.microsoft.com/v1.0/groups/${entitlementValue.entitlementID}/members/\$ref, httpParams:{"@odata.id":"https://graph.microsoft.com/v1.0/directoryObjects/${response.Groups.message.value[0].id}"}, httpMethod:POST, httpHeaders:[Authorization:${access_token}], httpContentType:application/json, successResponses:[statusCode:[200]]]]]

NM
Honored Contributor III
Honored Contributor III

Try this @prajakta 

url:https://graph.microsoft.com/beta/devices?$search=\"displayName%3A${account.accountID}\", 


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

prajakta
Regular Contributor
Regular Contributor

Appreciate your quick response.  Getting similar error for

"url": "https://graph.microsoft.com/beta/devices?$search=\"displayName%3A${account.accountID}\"",

 

2024-10-23T16:09:14+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-13-m9725-DEBUG-params.memento.addAccessJSON: [call:[[name:Groups1, connection:userAuth, url:https://graph.microsoft.com/beta/devices?$search="displayName%3A${account.accountID}", httpMethod:GET, httpHeaders:[Authorization:${access_token}, ConsistencyLevel:eventual], httpContentType:application/json, successResponses:[statusCode:[200]]], [name:Groups2, connection:userAuth, url:https://graph.microsoft.com/v1.0/groups/${entitlementValue.entitlementID}/members/\$ref, httpParams:{"@odata.id":"https://graph.microsoft.com/v1.0/directoryObjects/${response.Groups.message.value[0].id}"}, httpMethod:POST, httpHeaders:[Authorization:${access_token}], httpContentType:application/json, successResponses:[statusCode:[200]]]]]
 
2024-10-23T16:09:14+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-13-m9725-DEBUG-Calling Webservice Url - https://graph.microsoft.com/beta/devices?$search="displayName%3A${account.accountID}" with httpParams - null
 
2024-10-23T16:09:14+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-13-m9725-DEBUG-Got Webservice API Response: [error:Error Illegal character in query at index 49: https://graph.microsoft.com/beta/devices?$search="displayName%3A${account.accountID}"]