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

Unable to parse [ ] in REST Connector

rohitkumarraj
Regular Contributor
Regular Contributor

Hi,

I am working on a REST connector. In Add access JSON, trying to pass the below payload dynamically:

Working Payload from Postman:-

Assign group to the user API:

*****************************

URL: https://URLLL/api/v2/groups/ba4058e7-de7b-4e-a0cd-f61441c690e2/members

Body:

{
"memberIds" : ["bf418eaf-ed5a-4a87-a7a8-b3a84b5e1b96"],
"version" : "33"
}

*********************************

Tried converting above payload in the format which Saviynt supports :

{
"call": [
{
"name": "Group",
"connection": "userAuth",
"url": "https://URLLL/v2/groups/${entitlementValue.entitlementID}",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404,
429,
500,
503
]
}
},
{
"name": "Group",
"connection": "userAuth",
"url": "https://URLLL/api/v2/groups/${entitlementValue.entitlementID}/members",
"httpMethod": "POST",
"httpParams": "{\"memberIds\":\\[\"${account.accountID}\"]\\,\"version\":\"${response.Group1.message.version}\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
202
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404,
409,
429,
500,
503
]
}
}
]
}


But \"memberIds\":\\[\"${account.accountID}\"]\\ doesn't working for me. Getting unexpected char '\' error message. I am not sure what should be the format to parse [ ] using in this payload.

I need to get ["value"] format passed through JSON as shown in the above postman payload.

Can anyone please help me fix this?

Thanks

Rohit

4 REPLIES 4

Sivagami
Valued Contributor
Valued Contributor

Your payload body is below

 

{
"memberIds" : ["bf418eaf-ed5a-4a87-a7a8-b3a84b5e1b96"],
"version" : "33"
}

 

So, you just need to escape double quotes and leave square brackets as is. You don't have to escape them.

Your httpParams needs to look something like below.

 

"httpParams": "{\"memberIds\" : [\"bf418eaf-ed5a-4a87-a7a8-b3a84b5e1b96\"],\"version\" : \"33\"}",

 

Note: Replace binding variables as per your requirement in httpParams

Hope this helps!

-Siva

 

Thanks , @Sivagami . This worked!

sagars
Saviynt Employee
Saviynt Employee

@rohitkumarraj ,

Below Integration Document has similar Payload example for your reference. 

https://saviynt.freshdesk.com/a/solutions/articles/43000657280

There are many REST Examples available under Community Source Connector , I recommend to check them out.

Regards,

Sagar Srikantaiah

 

rohitkumarraj
Regular Contributor
Regular Contributor

Thank you @sagars , This document has very clear example for payload i was looking for.