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

Can we map complete array as is from response to attribute in UpdateAccountJSON

IAM_Mahesh
New Contributor
New Contributor

We are connecting to the target system where default payload needs to be sent in update transaction.

Payload has a mandatory attribute which we don't want to update in update transaction.

So we thought to make a get call (call1) and then make a update call (call2) mapping response of get call for mandatory attribute. 

Response of Call1 has array type attribute. So can we map complete array as is from response to mandatory attribute ?

Below is the response of get call containing mandatory attribute array :

"Credentials": [
{
"CardNumber": "15798",
"EndDate": "2022-12-21T23:59:59",
"Pin": "8135",
"ProfileId": 1
},
{
"CardNumber": "297",
"EndDate": "2022-12-21T23:59:59",
"Pin": "0",
"ProfileId": 11
}
],

Below is how mapping done in UpdateAccountJSON

\"Credentials\":${response.call1.message.Credentials[]?:''},

However this is failing, Any suggestion ??

6 REPLIES 6

amit_krishnajit
Saviynt Employee
Saviynt Employee

You may want to try to pass the value in the following way:

\"Credentials\":\"${response?.call1?.message?.Credentials?.size() > 0 ? response?.call1?.message?.Credentials : ''}\",

or

\"Credentials\":\"${response?.call1?.message?.Credentials?.length > 0 ? response?.call1?.message?.Credentials : ''}\",

 

Thanks,
Amit

Hi @amit_krishnajit

how can we parse such response in REST connector? folloing is full response, nothing is missing in it

[
{
"key": "APPLICATION_NAME",
"value": "Gitlab"
},
{
"key": "GROUP_CATEGORY",
"value": "CTB"
},
{
"key": "GROUP_PRIMARY_OWNER",
"value": "Test1"
},
{
"key": "GROUP_SECONDARY_OWNER",
"value": "Test2"
}
]

IAM_Mahesh
New Contributor
New Contributor

@amit_krishnajit Thank you for your response!

Array can not be passed in the double quotes ("" ), And seems without double quotes value not fetching from the response.

Can you please share the httpParams from the logs when you pass the array without the double quotes? 

You may enable extra logs in REST Connector by configuring Config JSON  in the following way:

{ "showLogs":true}

 

Thanks,
Amit

IAM_Mahesh
New Contributor
New Contributor

@amit_krishnajit Attached the httpParams with callResponse

adriencosson
Regular Contributor III
Regular Contributor III

You can pass some portion of code inside REST API Calls when getting a response that looks like array or map.

Example : Let's say you have a list of objects as response from your GET API Call, you might be able to use the following :

${for (Map map : response.call1.message) {<INSERT LOGIC>}}

 Where "call1" is your GET API Call name, message contains your list of objects, and you want to iterate over the list.

Regards,
Adrien COSSON