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

Map Rest API Response during User Import

Abhay_Yadav
New Contributor II
New Contributor II

Hi All,

We have to onboard HR app using Rest connector. 

The data coming from HR is not in "Key":"Value" format.

But is in a different format:

[{

name:"Company",

value:"Microsoft"

},

{

name:"Department",

value:"Finance"

 

}]

 

Is there a way to map this kind of response in import user json.

PFA the sample response of API.

Regards,

Abhay Yadav

12 REPLIES 12

NM
Honored Contributor III
Honored Contributor III

Hi @Abhay_Yadav , yes you can 

Do like this"additionalfield[0].value"


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

Abhay_Yadav
New Contributor II
New Contributor II

Hi @NM,

This will work assuming that response is always in same order for all users. What if response is not in same order or few entries for users are not coming in the response. 

How can we fetch the value based on "Name" field.

Regards,

Abhay Yadav

rushikeshvartak
All-Star
All-Star

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak ,

Can you please help me with the section/page of the document that has this kind of response mapping.

Regards,

Abhay Yadav

Do like this "additionalfield['Department'].value"


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak,

"additionalFields['Job_Title''].value" is throwing below error.

Abhay_Yadav_0-1721288508372.png

Regards,

Abhay Yadav

 

Hi @rushikeshvartak ,

I tried this also but it's getting stored as a string instead of getting processed.

${List responseList = response?.data?.additionalFields; int count = 0; int size = responseList.size(); Iterator iterator = responseList.iterator(); while (iterator.hasNext()){count++; Map dataMap = iterator.next(); if('Job_Title'.equals(dataMap.name)){return dataMap.value}else if(count == size){return null}}}

Abhay_Yadav_1-1721289902737.png

 

IN that case you have syntax issue


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Abhay_Yadav
New Contributor II
New Contributor II

Hi @rushikeshvartak ,

I tried multiple things but does not seem to be working. Can you please help me with the correct syntax based on the response attached in first comment.

Regards,

Abhay Yadav

Please share full json


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak 

PFA the response and user import json.

"customproperty60": "#CONST#${List responseList = response?.data?.additionalFields; int count = 0; int size = responseList?.size() ?: 0; Iterator iterator = responseList?.iterator() ?: [].iterator(); while (iterator.hasNext()) { count++; Map dataMap = iterator.next(); if ('Job_Title'.equals(dataMap.name)) { return dataMap.value } else if (count == size) { return null } }}~#~char"


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.