Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

Error in mapping JSON value from Import - REST Connector

ckodi
New Contributor II
New Contributor II

In the Rest connector for Account and Entitlement import we are facing an issue while trying to retrieve a key: value pair from the response body of the Web API call. We are able to retrieve all the attributes that are in the response body at the top level. The attribute that we are unable to retrieve is one level below in the response body. Here is the response:

{

"id": "12be3d86-XXXXXXX-XXXXXXXX",

"schemas": [

"urn:ietf:params:scim:schemas:core:2.0:User",

"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",

"urn:ietf:params:scim:schemas:extension:sap:2.0:User"

],

"userName": "abc123",

"active": true,

"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {

"employeeNumber": "abc123"

}

}

I tried the following code in my Import JSON to retrieve the employeeNumber attribute which is not at the top level as shown in the above response body:

customproperty7": "['urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'].employeeNumber~#~char"

"customproperty7": "[urn:ietf:params:scim:schemas:extension:enterprise:2.0:User].employeeNumber~#~char"

"customproperty7": ['urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'].employeeNumber~#~char

"customproperty7": “‘urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'.employeeNumber~#~char"

"customproperty7": "['urn\:ietf\:params\:scim\:schemas\:extension\:enterprise\:2.0\:User'].employeeNumber~#~char"

"customproperty7": "[“urn\:ietf\:params\:scim\:schemas\:extension\:enterprise\:2.0\:User”].employeeNumber~#~char"

"customproperty7": "User.employeeNumber~#~char"

We are unable to extract the employeeNumber from the response below and map it to CustomProperty7 in ColsToPropsMap due to the colon ‘:’ and period ‘.’ characters present in the JSON body’s KEY which is "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User”:

I am getting the following error when I try to retrieve the employeeNumber using the above methods: “Exception in RestUtil get At: java.lang.NumberFormatException: For input string: “urn:ietf:params:scim:schemas:extension:enterprise:2”.

I am able to retrieve the ID and status without any issue using the following code in my Import mapping JSON since they are at the top level in the import response body:

"colsToPropsMap": {

"accountID": "id~#~char",

"status": "active~#~char"

},

Any help or guidance is appreciated.

3 REPLIES 3

h_sapkota
Regular Contributor
Regular Contributor

Hi Ckodi,

Can you please try this. I have encountered similar issue and it worked.

"customproperty7": "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.EmployeeNumber~#~char"

Let me know if it didn't work.

Regards,

Hitesh Sapkota

ckodi
New Contributor II
New Contributor II

Hi Hitesh,

Thank you for your response.

I tried your recommendation "customproperty7": "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.EmployeeNumber~#~char", but still value is not getting mapped.

Here are the other combinations I have tried:

"customproperty7": "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.employeeNumber~#~char"

"customproperty7": "urn\:ietf\:params\:scim\:schemas\:extension\:enterprise\:2\.0\:User\.employeeNumber~#~char"

"customproperty7": "'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'.employeeNumber~#~char"

"customproperty7": "urn\\:ietf\\:params\\:scim\\:schemas\\:extension\\:enterprise\\:2\\.0\\:User\\.employeeNumber~#~char"

This Exception occurs which seems to happen at the number '2' in that long Key:

2022-11-30 11:12:32,009 [quartzScheduler_Worker-3] DEBUG rest.RestUtilService - Exception in RestUtil.getAt : java.lang.NumberFormatException: For input string: "urn:ietf:params:scim:schemas:extension:enterprise:2"

Thank you

ckodi
New Contributor II
New Contributor II

Hi Hitesh,

The following solution worked for accessing the key from the JSON response:

Appending ~dot# for the period ('.') in '2.0' in the JSON key worked:

"customproperty7":"urn:ietf:params:scim:schemas:extension:enterprise:2~dot#0:User.employeeNumber~#~char"

This is also available in REST connector - https://docs.saviyntcloud.com/bundle/REST-v2022x/page/Content/Developers-Handbook.htm#ImportUs when searched (crtl+f) for "dot".

Kind regards,

Chandu