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

How to add variable to Graph API URL param in JSON object to consume value dynamincally

SureshPatike
Regular Contributor
Regular Contributor

Need your help to figure out how to pass the variable value in one of the parameter on the below JSON object. am getiing error from Saviynt that illegal char $ in URL and its works fine if i hardcode the value in place of variable. Could you please help how to pass the variable dynamically when we want to execute URL based on certain custom property values conditions like below?

Not working:

"url": "${user.customproperty39.trim().equals('Inactive')? 'https://graph.microsoft.com/v1.0/users/${user.email}/mailboxSettings':'https://graph.microsoft.com'}",

working:

"url": "${user.customproperty39.trim().equals('Inactive')? 'https://graph.microsoft.com/v1.0/users/test@abc.com/mailboxSettings':'https://graph.microsoft.com'}",

"url": "https://graph.microsoft.com/v1.0/users/test@abc.com/mailboxSettings",

Also, would like to know how to pass the new line (\n) char in JSON string in one of the httpParams.

10 REPLIES 10

DixshantValecha
Saviynt Employee
Saviynt Employee

Hi @SureshPatike ,

We are checking on this and we will update you.

Thank you Dixshant,

I was able to figure out how to pass the variable in Graph API, but i still have error to parse new line char. Saviynt keep throwing error below when execute on disableaccount action. Am able to set OOO for mailbox using graph api without newline but all info come in one line. 

"call2":{"message":"Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: {\"automaticRepliesSetting\":{\"status\":\"alwaysEnabled\",\"internalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.</span></p>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause.</span></p>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact username (email) who will be able to provide you with any support you require.</span></p>\n<br>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.</span></p>\n</html>\",\"externalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.</span></p>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause.</span></p>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact username (email) who will be able to provide you with any support you require.</span></p>\n<br>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.</span></p>\n</html>\"}}; line: 1, column: 304]","status":"Failed"}}

Hemanath
Saviynt Employee
Saviynt Employee

Hi @SureshPatike ,

How you are passing the value, can you share the Json.

Thanks,

Hemanath J

{
"name": "call2",
"connection": "userAuth",
"url": "${user.customproperty39.trim().equals('Inactive')? 'https://graph.microsoft.com/v1.0/users/'+account.accountID+'/mailboxSettings':'https://graph.microsoft.com'}",
"httpMethod": "PATCH",
"httpParams": "{\"automaticRepliesSetting\":{\"status\":\"alwaysEnabled\",\"internalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.<\/span><\/p>\\n<br/>\\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with. We apologize for any inconvenience this may cause.<\/span><\/p>\\n<br>\\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact ${userManager.displayname} (${userManager.email}) who will be able to provide you with any support you require.<\/span><\/p>\\n<br>\\n<br>\\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.<\/span><\/p>\\n<\/html>\",\"externalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.<\/span><\/p>\\n<br>\\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with. We apologize for any inconvenience this may cause.<\/span><\/p>\\n<br>\\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact ${userManager.displayname} (${userManager.email}) who will be able to provide you with any support you require.<\/span><\/p>\\n<br>\\n<br>\\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.<\/span><\/p>\\n<\/html>\"}}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
}
}

 

 

but above one throwing error below. need to find what can escape new line and allow html tags to next line. ""call2":{"message":"Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n"

@SureshPatike remove \\n and try encoding the parameters

As i mentioned already above, Graph API executed succesfully from Saviynt if i dont have \\n or \n in the message. but information the way setup in mailbox is like in one line and it doesnt break into different paragraphs even there are <p> tags in it. So, to break paragraph's, i have to put new line after each of <p>'s.

Hi @SureshPatike,

Please validate

{
"automaticRepliesSetting": {
"status": "alwaysEnabled",
"internalReplyMessage": "<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.</span></p>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause.</span></p>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact username (email) who will be able to provide you with any support you require.</span></p>\u000A<br>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.</span></p>\u000A</html>",
"externalReplyMessage": "<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.</span></p>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause.</span></p>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact username (email) who will be able to provide you with any support you require.</span></p>\u000A<br>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.</span></p>\u000A</html>"
}
}

No luck. still see same error.

{
"name": "call2",
"connection": "userAuth",
"url": "${user.customproperty39.trim().equals('Inactive')? 'https://graph.microsoft.com/v1.0/users/'+account.accountID+'/mailboxSettings':'https://graph.microso...'}",
"httpMethod": "PATCH",
"httpParams": "{\"automaticRepliesSetting\":{\"status\":\"alwaysEnabled\",\"externalAudience\":\"all\",\"internalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.<\/span><\/p>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause.<\/span><\/p>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact ${userManager.displayname} (${userManager.email}) who will be able to provide you with any support you require.<\/span><\/p>\u000A<br>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.<\/span><\/p>\u000A<\/html>\",\"externalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.<\/span><\/p>\u000A<br \/>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause.<\/span><\/p>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact ${userManager.displayname} (${userManager.email}) who will be able to provide you with any support you require.<\/span><\/p>\u000A<br>\u000A<br>\u000A<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.<\/span><\/p>\u000A<\/html>\"}}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
}
}

 

Error Response is below:

"call2":{"message":"Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: {\"automaticRepliesSetting\":{\"status\":\"alwaysEnabled\",\"externalAudience\":\"all\",\"internalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.</span></p>\n<br />\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause.</span></p>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact  who will be able to provide you with any support you require.</span></p>\n<br>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.</span></p>\n</html>\",\"externalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you for reaching out to us.</span></p>\n<br />\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause.</span></p>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Please contact  who will be able to provide you with any support you require.</span></p>\n<br>\n<br>\n<p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space: pre>Thank you and best regards.</span></p>\n</html>\"}}; line: 1, column: 329]","status":"Failed"}}

i was able to resolve the issue. \\n need to be replaced with \\\\n

here is the working JSON request

{
"name": "call2",
"connection": "userAuth",
"url": "${user.customproperty39.trim().equals('Inactive')? 'https://graph.microsoft.com/v1.0/users/'+account.accountID+'/mailboxSettings':'https://graph.microso...'}",
"httpMethod": "PATCH",
"httpParams": "{\"automaticRepliesSetting\":{\"status\":\"alwaysEnabled\",\"externalAudience\":\"all\",\"internalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space:pre>Thank you for reaching out to us. \\\\nPlease note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause. \\\\nPlease contact ${userManager.displayname} (${userManager.email}) who will be able to provide you with any support you require. \\\\n\\\\nThank you and best regards.<\/span><\/p><\/html>\",\"externalReplyMessage\":\"<html><p style=margin-top:0in;margin-right:0in;margin-bottom:11.0pt;margin-left:0in><span style=font-family:Univers Light,sans-serif;font-size:11.0pt;color:#3C3C3C;white-space:pre>Thank you for reaching out to us. \\\\nPlease note that the individual you are trying to contact is no longer with . We apologize for any inconvenience this may cause. \\\\nPlease contact ${userManager.displayname} (${userManager.email}) who will be able to provide you with any support you require. \\\\n\\\\nThank you and best regards.<\/span><\/p><\/html>\"}}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
}
}

DixshantValecha
Saviynt Employee
Saviynt Employee

Thnaks for the update @SureshPatike  the issu egot resolve:- \\n need to be replaced with \\\\n