05/18/2022 10:12 AM
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
Solved! Go to Solution.
05/18/2022 10:52 AM - edited 05/18/2022 11:04 AM
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
05/19/2022 11:41 AM
Thanks , @Sivagami . This worked!
05/18/2022 11:08 AM
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
05/19/2022 11:42 AM