Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

REST - ImportAccountEntJSON for XML to JSON converted response

shivmano
Regular Contributor III
Regular Contributor III

Hi Team,

I have an XML response from a target application that I have converted to JSON and below is the json response. Here I am looking for process to import the email, fullName and name parameters using the ImportAccountEntJSON but the keys "_name" and "_value" is the same for all the attributes that are returned. 

My listpath is 'attributes' but I would like to know how can I pull the _value for only email, fullName and name as it is the same for all the other attributes that are in response which I do not want to import 

{
"list": {
"resource": {
"attributes": {
"attribute": [
{
"_name": "apiUser",
"_value": "true"
},
{
"_name": "applicationModificationPermission",
"_value": "false"
},
{
"_name": "avatar"
},
{
"_name": "dateFormat"
},
{
"_name": "email",
"_value": "firstname.lastname@domain.com"
},
{
"_name": "fullName",
"_value": "Firstname Lastname"
},
{
"_name": "name",
"_value": "Firstname"
},
{
"_name": "numberSeparators"
},
{
"profiles": {
"organization": {
"role": {
"_name": "API User"
},
"_name": "Global Sales"
}
},
"_name": "profiles"
}
]
}
}
}
}

Please let me know if there is any input for this that I can try. I have attached the XML response from target, JSON converted response as well as the ImportAccountEntJSON I have drafted. I need to be able to know how to map the required values from _value for email and fullname as they both have the same attribute name as _value 

Thank you 

[This message has been edited by moderator to merge reply comment]

9 REPLIES 9

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @shivmano,

You May try below json.

 

{
	"accountParams": {
		"connection": "userAuth",
		"showResponse": true,
		"processingType": "SequentialAndIterative",
		"call": {
			"call1": {
				"connection": "userAuth",
				"callOrder": 0,
				"stageNumber": 0,
				"http": {
					"url": "https://xxxxxxxx",
					"httpHeaders": {
						"Accept": "application/json",
						"Authorization": "${access_token}"
					},
					"httpContentType": "application/json",
					"httpMethod": "GET"
				},
				"listField": "resource",
				"keyField": "accountID",
				"colsToPropsMap": {
					"accountID": "attributes.attribute[4]._value~#~char",
					"name": "attributes.attribute[5]._value~#~char",
					"customproperty1": "attributes.attribute[8]._value~#~char",
					"customproperty31": "STORE#ACC#ENT#MAPPINGINFO~#~char"
				}
			}
		},
		"acctEntMappings": {
			"Role": {
				"listPath": "role",
				"idPath": "_name",
				"keyField": "entitlement_value",
				"importAsEntitlement": false
			}
		}
	},
	"entitlementParams": {
		"processingType": "SequentialAndIterative",
		"entTypes": {
			"Role": {}
		},
		"disableDeletedEntitlements": true
	},
	"acctEntParams": {
		"entTypes": {
			"Role": {
				"call": {
					"call1": {
						"callOrder": 0,
						"stageNumber": 0,
						"processingType": "acctToEntMapping"
					}
				}
			}
		}
	}
}

 


Thanks.

If you find the above response useful, Kindly Mark it as "Accept As Solution".

Vedanth-BK
Regular Contributor
Regular Contributor

Hi @shivmano 
Please try with the below in your colsToPropsMap

"accountID": "attributes.attribute[4]._value~#~char",
"customproperty1": "attributes.attribute[5]._value~#~char"


 

Thank you
Vedanth B.K

shivmano
Regular Contributor III
Regular Contributor III

@sudeshjaiswal @Vedanth-BK This does not seem to work. I dont see the account attributes pulled in after the import is run. Neither is there any error in logs. Below is the import json i'm using. can you please check. 

Also, the response that is coming from the GET Call is in XML format. So how will Saviynt know to convert that into JSON and map attributes from the JSON Response? 

 

{
"accountParams": {
"connection": "userAuth",
"showResponse": true,
"processingType": "SequentialAndIterative",
"call": {
"call1": {
"connection": "userAuth",
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://xxxxxx",
"httpHeaders": {
"Accept": "application/json",
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"listField": "resource",
"keyField": "accountID",
"colsToPropsMap": {
"accountID": "attributes.attribute[4]._value~#~char",
"name": "attributes.attribute[4]._value~#~char",
"customproperty1": "attributes.attribute[5]._value~#~char",
"customproperty3": "attributes.attribute[8]._value~#~char",
"customproperty4": "_id~#~char",
"customproperty5": "_revisionId~#~char",
"customproperty31": "STORE#ACC#ENT#MAPPINGINFO~#~char"
}
}
},
"acctEntMappings": {
"Role": {
"listPath": "role",
"idPath": "_name",
"keyField": "entitlement_value",
"importAsEntitlement": false
}
}
},
"entitlementParams": {
"processingType": "SequentialAndIterative",
"entTypes": {
"Role": {}
},
"disableDeletedEntitlements": true
},
"acctEntParams": {
"entTypes": {
"Role": {
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"processingType": "acctToEntMapping"
}
}
}
}
}
}

shivmano
Regular Contributor III
Regular Contributor III

I am also trying to just do an account import by using unique attributes and still the account is not being imported: Below is the JSON 

{
"accountParams": {
"connection": "userAuth",
"processingType": "SequentialAndIterative",
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://xxxxxx",
"httpHeaders": {
"Authorization": "${access_token}"

},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"listField": "resource",
"keyField": "accountID",
"colsToPropsMap": {
"accountID": "_id~#~char",
"name": "_id~#~char",
"displayName": "_id~#~char",
"customproperty4": "_revisionId~#~char"
}
}
}
}
}

I can see in the logs that the webservice call response is coming in XML format (Content-Type: application/xml). But logs do not show anything about Saviynt consuming that as JSON 

Please advise 

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @shivmano,

Can you please try with the below json,

 

{
	"accountParams": {
		"connection": "userAuth",
		"showResponse": true,
		"processingType": "SequentialAndIterative",
		"call": {
			"call1": {
				"connection": "userAuth",
				"callOrder": 0,
				"stageNumber": 0,
				"http": {
					"url": "https://XXXX",
					"httpHeaders": {
						"Authorization": "${access_token}",
						"Content-Type": "text/xml"
					},
					"httpContentType": "application/json",
					"httpMethod": "GET"
				},
				"listField": "list.resource",
				"keyField": "accountID",
				"colsToPropsMap": {
					"accountID": "attributes.attribute[4]._value~#~char",
					"name": "attributes.attribute[4]._value~#~char",
					"customproperty1": "attributes.attribute[5]._value~#~char",
					"customproperty3": "attributes.attribute[8]._value~#~char",
					"customproperty4": "_id~#~char",
					"customproperty5": "_revisionId~#~char",
					"customproperty31": "STORE#ACC#ENT#MAPPINGINFO~#~char"
				}
			}
		},
		"acctEntMappings": {
			"Role": {
				"listPath": "attributes.attribute[10].profiles.organization.role",
				"idPath": "_name",
				"keyField": "entitlement_value",
				"importAsEntitlement": false
			}
		}
	},
	"entitlementParams": {
		"processingType": "SequentialAndIterative",
		"entTypes": {
			"Role": {}
		},
		"disableDeletedEntitlements": true
	},
	"acctEntParams": {
		"entTypes": {
			"Role": {
				"call": {
					"call1": {
						"callOrder": 0,
						"stageNumber": 0,
						"processingType": "acctToEntMapping"
					}
				}
			}
		}
	}
}

 

Thanks.

If you find the above response useful, Kindly Mark it as "Accept As Solution".

shivmano
Regular Contributor III
Regular Contributor III

@sudeshjaiswal , thank you for the response. Unfortunately, it still does not work. No records are imported though the objects are returned in the response. Here is what I see in logs

2024-03-04T15:17:41+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-1-rmjhv-DEBUG-Got showLogs = true
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-Got Webservice API Response: [headers:[Date: Mon, 04 Mar 2024 09:47:41 GMT, Content-Type: application/xml; charset=utf-8, Connection: keep-alive, Strict-Transport-Security: max-age=31536000; includeSubDomains, Cache-Control: no-cache, max-age=0, must-revalidate, no-store], responseText:<list*******</list>, cookies:[], statusCode:200]
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-1-rmjhv-DEBUG-pullObjectsByRest - responseStatusCode ::200
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-Entered getResponseHeaders method
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-responseError : null
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-isAuthError: false
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-pullObjectsByRest - responseMap.size : 1
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-pullObjectsByRest - objectList.size : 10
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-Decrementing connectionParamMap.refreshTryCount : 0
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-Inside importAccountsFull:persistAccounts, pptTypeSep : ~#~
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-associated entitlement : Role with account is not for import.
2024-03-04T15:17:41+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-1-rmjhv-DEBUG-INFO: Account Name is null, record not saved.
2024-03-04T15:17:41+05:30-ecm-worker-services.ImportUtilityService-quartzScheduler_Worker-1-rmjhv-DEBUG-isImportSuccess: true

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @shivmano,

Can you share the postman screenshot and the content type.


Thanks.


If you find the above response useful, Kindly Mark it as "Accept As Solution".

shivmano
Regular Contributor III
Regular Contributor III

shivmano_0-1709630082358.pngshivmano_1-1709630141961.png

 

shivmano
Regular Contributor III
Regular Contributor III

Hi Team,

I have an application which returns response objects only in application/xml format. I am able to convert the XML response into JSON and using my import mappings according to the JSON Response. But it looks like no objects are being imported even though the job is successful.

I can see that the objects are being successfully pulled but in XML format:

Got Webservice API Response: [headers:[Date: Fri, 01 Mar 2024 10:42:10 GMT, Content-Type: application/xml; charset=utf-8, Connection: keep-alive, Strict-Transport-Security: max-age=31536000; includeSubDomains, Cache-Control: no-cache, max-age=0, must-revalidate, no-store], responseText:XXXXXX, cookies:[], statusCode:200]

But I am not sure if Saviynt is able to convert this into JSON format or not. Please can someone advise? I have attached the XML response, JSON response (converted) and the ImportAccountEntJSON