Click HERE to see how Saviynt Intelligence is transforming the industry. |
03/05/2024 01:36 AM
I have a REST connector. I want to add a callcondition with regex in connection json. Is there any sample of the same?
Solved! Go to Solution.
03/06/2024 02:00 AM
Please share the details on the call condition you are trying to achieve.
03/06/2024 05:16 AM
Please find below the action JSON. I have added "No", "NO" & "no" multiple times for checking the values, instead want to check if we can use regex to simplify the condition and combine it in a single check.
{
"actions": {
"Disable User": {
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://addepar-dev.saviyntcloud.com/ECM/api/v5/updateUser",
"httpMethod": "POST",
"httpParams": "{\"username\":\"${user.username}\",\"statuskey\":\"0\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"callCondition": "${(user.customproperty14 == '' || user.customproperty14 == null || user.customproperty14 == \"No\" || user.customproperty14 == \"NO\" || user.customproperty14 == \"no\") && (user.customproperty16 == '' || user.customproperty16 == null)}",
"successResponses": {
"statusCode": [
201,
200,
204
]
}
}
]
}
}
}
03/06/2024 05:25 AM
Here's an example of using a callcondition with regex in connection JSON for a REST connector:
```
{
"call": [
{
"name": "call1",
"url": "https://api.example.com",
"httpMethod": "GET",
"callCondition": "${user.username.matches('.*@example\\.com$')}"
},
{
"name": "call2",
"url": "https://api.example.com",
"httpMethod": "POST",
"callCondition": "${user.role == 'admin'}"
}
]
}
```
In this example, call1 will only be executed if the user's username matches the regex pattern `'.*@example\\.com$'`, which means it should end with '@example.com'. Similarly, call2 will only be executed if the user's role is set to 'admin'. You can modify the regex pattern and the condition based on your specific requirements.
03/06/2024 05:29 AM
How can I make it case insensitive?
03/06/2024 05:45 AM
To add a call condition with regex in the connection JSON of a REST connector, you can use the "callCondition" parameter. Here's an example:
```json
{
"call": [
{
"name": "call1",
"connection": "auth",
"url": "https://api.example.com",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
},
"callCondition": "${user.username matches '(?i)regex_pattern'}"
}
]
}
```
In the above example, the "callCondition" parameter is used to specify the regex pattern. The `(?i)` at the beginning of the pattern makes it case insensitive. You can replace "regex_pattern" with your desired regex.