We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

REST Multiple Calls in CreateAccountJSON

varunpuri
Regular Contributor
Regular Contributor

Hi,

We are using REST connector to create accounts in Azure using the Graph API.
We are reading the values to be passed from the dynamic attributes. Until this point flow is okay.

Problem : Manager value also needs to be pushed in Azure. Manager is represented as a separate object in azure. So, within the CreateAccountJSON, we need to make multiple calls.

Call1 : Will create the user by reading the values from dynamic attributes
Call2 : Will read the manager object (id attribute) by again reading the value of manager entered in dynamic attribute displayed on ARS.
Call3 : Will update the manager in user created in Call1.

I have configured Call1 and Call2 and getting an error. In Call2, I need to invoke a GET API to fetch the id of manager. The URL used in this GET call has a space within so I have used %20 instead of space.

When I run the application provisioning job, I get the following error in the task :

{"call1":{"headers":null,"message":{"error":{"code":"Request_BadRequest","message":"Property netId is invalid.","details":[{"code":"GenericError","message":"Property netId is invalid.","target":"netId"}],"innerError":{"date":"2023-12-20T10:47:02","request-id":"085d3075-e1a6-4921-8c81-133027ad5d3d","client-request-id":"085d3075-e1a6-4921-8c81-133027ad5d3d"}}},"statusCode":400,"description":null,"status":"Failed"}}

Attaching the CreateAccountJSON here. Appreciate your help.

Best Regards,
Varun

10 REPLIES 10

rushikeshvartak
All-Star
All-Star
 

Please add stageNumber and Callorder configs in json

 

 
{
    "accountIdPath": "call1.message.id",
    "dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
    "responseColsToPropsMap": {
        "lastname": "call1.message.lastname~#~char",
        "givenName": "call1.message.givenName~#~char",
		"customproperty10":"call2.message.id~#~char"
    },
    "call": [
        {
            "name": "call1",
            "connection": "userAuthForB2C",
            "url": "https://graph.microsoft.com/v1.0/users",
            "httpMethod": "POST",
            "httpParams": "{\"accountEnabled\":\"true\",\"State\":\"${requestAccessAttributes.get('State')}\",\"City\":\"${requestAccessAttributes.get('City')}\",\"country\":\"${requestAccessAttributes.get('country')}\",\"JobTitle\":\"${requestAccessAttributes.get('PositionTitle')}\",\"givenName\":\"${requestAccessAttributes.get('firstName')}\",\"mail\":\"${requestAccessAttributes.get('mail')}\",\"surname\":\"${requestAccessAttributes.get('surname')}\",\"userPrincipalName\":\"${requestAccessAttributes.get('mail')}\",\"displayName\":\"${requestAccessAttributes.get('surname') + ', ' + requestAccessAttributes.get('firstName')}\",\"Department\":\"${requestAccessAttributes.get('department')}\",\"extension_22afe096dd2048f0bfe0ba42ffb5c947_Title\":\"${requestAccessAttributes.get('title')}\",\"mobilePhone\":\"${requestAccessAttributes.get('mobile')}\",\"extension_22afe096dd2048f0bfe0ba42ffb5c947_Organization\":\"ABC\",\"mailNickname\":\"${arstasksObj?.accountName}\",\"passwordProfile\":\r\n{\"password\":\"syPQMYfP_TvrMfmxt2Rq\",\"forceChangePasswordNextSignIn\":\"true\"}}",
            "httpHeaders": {
                "Authorization": "${access_token}"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    200,
                    201,
                    204,
                    205
                ]
            }
        },
        {
            "name": "call2",
            "connection": "userAuthForB2C",
            "url": "https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20${requestAccessAttributes.get('manager')}&$select=id",
            "httpMethod": "GET",
            "httpHeaders": {
                "Authorization": "${access_token}"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    200,
                    201,
                    204,
                    205
                ]
            }
        }		
    ]
}

Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Thank You, @rushikeshvartak, for your response.

I was able to resolve it WITHOUT stagenumber and callOrder but now, another issue is there :

Following exception is there in the logs :

error:Error Illegal character in query at index 72: https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20${requestAccessAttributes.get...]"
"2023-12-20T19:54:29.065+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-2-zfn9f","ERROR","Exception in getting response in pullObjectsByRest :

Apparently, the error is coming due to the usage of $ in ${requestAccessAttributes.get........}

So, I replaced the $ with %24 but again the following error came up :

error:Error Illegal character in query at index 74: https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20%24{requestAccessAttributes.g...]"
"2023-12-21T05:16:07.426+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-7-fc6c5","ERROR","Exception in getting response in pullObjectsByRest :"

Kindly suggest some resolution around it

Best Regards,
Varun

https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20%24%7BrequestAccessAttributes...


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Hello @rushikeshvartak ,

The suggested URL is NOT working.

Additionally, I also tried using the following, but none of them worked :

1. ${https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20+requestAccessAttributes.get(...}

2. %24{https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20+requestAccessAttributes.get(...}

3. https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20%24{requestAccessAttributes.g...

4. https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20%24%7BrequestAccessAttributes...

5. https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20%24%7BrequestAccessAttributes...

The only thing is that the error message has changed to the following :

call1":{"headers":null,"message":{"error":{"code":"BadRequest","message":"Invalid filter clause: Syntax error at position 49 in 'mail eq ${requestAccessAttributes.get('manager')}'.","innerError":{"date":"2023-12-21T09:28:36","request-id":"29a0f85e-7ae8-446b-9970-c380540b957a","client-request-id":"29a0f85e-7ae8-446b-9970-c380540b957a"}}

Best Regards,
Varun

Hi,

I was able to resolve the dynamic attribute inside the URL by using this syntax :

${'https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20\\'' + requestAccessAttributes.get('manager') + '\\'&$select=id'}

Now, the value of requestAccessAttributes.get('manager') is getting resolved but an Illegal character issue is coming in :

"2023-12-21T12:56:58.403+00:00","ecm-worker","rest.RestUtilService","quartzScheduler_Worker-8-fc6c5","DEBUG","Got null response statusCode with erroMsg - [error:Error Illegal character in query at index 63: https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail eq 'purivarun@abc.gov.com'&$select=id]"
"2023-12-21T12:56:58.403+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-8-fc6c5","ERROR","Exception in getting response in pullObjectsByRest :"

Best Regards,
Varun

varunpuri
Regular Contributor
Regular Contributor

I was able to resolve it. The final URL which worked for me is :

${'https://graph.microsoft.com/v1.0/users?$count=true&$filter%3Dmail%20eq%20\\'' + requestAccessAttributes.get('manager') + '\\'&$select=id'}

Best Regards,
Varun

Great close the thread

${'https://graph.microsoft.com/v1.0/users?$count=true&$filter%3Dmail%20eq%20\\'' + requestAccessAttributes.get('manager') + '\\'&$select=id'}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

iam01
Regular Contributor
Regular Contributor

@varunpuri @rushikeshvartak Please provide some insight as to why we are using // in the following url; I have highlighted it in red

 

${'https://graph.microsoft.com/v1.0/users?$count=true&$filter%3Dmail%20eq%20\\'' + conrequestAccessAttributes.get('manager') + '\\'&$select=id'}

 

is my understanding correct with below example:
String1 : 'https://graph.microsoft.com/v1.0/users?$count=true&$filter%3Dmail%20eq%20\\'
string1 + String2: ' + requestAccessAttributes.get('manager') + '
string1 + String2 +string3: \\'&$select=id'

Escape 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

iam01
Regular Contributor
Regular Contributor

below is orginal url and it dosnt contains backslash, could not understand why we are doing escape

"url": "https://graph.microsoft.com/v1.0/users?$count=true&$filter=mail%20eq%20${requestAccessAttributes.get('manager')}&$select=id",