Click HERE to see how Saviynt Intelligence is transforming the industry. |
10/23/2024 02:20 AM - edited 10/23/2024 02:22 AM
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
10/23/2024 02:32 AM
@prajakta can you share prov logs?
10/23/2024 03:17 AM
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]]]]]
10/23/2024 03:25 AM
Try this @prajakta
url:https://graph.microsoft.com/beta/devices?$search=\"displayName%3A${account.accountID}\",
10/23/2024 03:40 AM
Appreciate your quick response. Getting similar error for
"url": "https://graph.microsoft.com/beta/devices?$search=\"displayName%3A${account.accountID}\"",
10/23/2024 06:39 AM
Please share full JSON
10/23/2024 06:58 AM
here is the JSON
{
"call": [
{
"name": "Groups",
"connection": "userAuth",
"url": "https://graph.microsoft.com/beta/devices?$search=%22displayName:+${account.accountID}%22",
"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
]
}
}
]
}
10/23/2024 07:00 AM
Did you validated with hardcoded values ?
10/23/2024 07:03 AM
Yes the first GET API call goes through successfully and it does fail for 2nd. But with accountID the API itself is not getting invoked.
10/23/2024 07:07 AM
{
"call": [
{
"name": "Groups",
"connection": "userAuth",
"url": "https://graph.microsoft.com/beta/devices?$search=%22displayName%3A${URLEncoder.encode(account.accountID, 'UTF-8')}%22",
"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
]
}
}
]
}
10/23/2024 07:13 AM
Thanks Rushikesh, getting below error for above JSON
10/23/2024 07:15 AM
{
"call": [
{
"name": "Groups",
"connection": "userAuth",
"url": "https://graph.microsoft.com/beta/devices?$search=%22displayName%3A${account.accountID.replace(':', '%3A').replace(' ', '%20')}%22",
"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
]
}
}
]
}
10/23/2024 07:23 AM
No luck yet.
10/23/2024 07:31 AM - edited 10/23/2024 07:33 AM
Is it because of " before displayname the $ is not getting resolved?
Also the accountId is alphanumeric field without any special characters