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 connector response in other JSON.

Rajatlm10
New Contributor III
New Contributor III

I need to use the response from Create JSON in add access JSON. 

like i want to use the "id" attribute from create JSON in the add access json call. 

Can anyone help me on this ? i am not getting how to do it. 

 

i am pasting the create and add access JSON below for reference. 

CREATE JSON 

{
"accountIdPath": "call1.message.userName",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://removed.com/Users",
"httpMethod": "POST",
"httpParams": "{\"schemas\":[\"urn:ietf:params:scim:schemas:core:2.0:User\"],\"emails\":[{ \"value\":\"moni.sharma@abc.com\",\"type\": \"work\"}],\"active\":true,\"userName\":\"${user.email}\",\"name\":{\"formatted\":\"Moni\",\"familyName\":\"sharma\",\"givenName\":\"sampleTest\"},\"urn:ietf:params:scim:schemas:extension:spend:2.0:User\":{\"ledgerCode\":\"LEDGER\",\"country\":\"US\",\"locale\":\"en_US\",\"reimbursementCurrency\":\"USD\",\"customData\": [ {\"id\":\"custom21\",\"value\":\"US\"}, {\"id\":\"orgUnit1\",\"value\":\"001\"},{\"id\":\"custom20\",\"value\":\"001\"},{\"id\":\"orgUnit4\",\"value\":\"US\"},{\"id\":\"orgUnit2\",\"value\":\"E0119\"},{\"id\":\"custom1\",\"value\":\"apitest@abc.com\"}]},\"urn:ietf:scim:extension:enterprise:2.0:User\":{\"employeeNumber\":\"${user.email}\", \"companyId\":\"abcd\"},\"urn:ietf:params:scim:schemas:extension:spend:2.0:Role\":{\"roles\":[{\"roleName\": \"EXP_USER\"},{\"roleName\": \"EXP_APPROVER\"},{\"roleName\": \"STATEMENT_APPROVER\"},{\"roleName\": \"STATEMENT_USER\"}]}}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
404,
500,
501,
502,
503,
504
]
}
}
]
}

 

 

 

ADD ACCESS JSON

{
"call": [
{
"connection": "acctAuth",
"url": "https://removed.com/Users/${response.call1.message.id}",
"httpMethod": "PATCH",
"httpParams": "{\"schemas\":[\"urn:ietf:params:scim:schemas:core:2.0:User\"],\"Operations\":[{\"op\": \"add\",\"path\":\"urn:ietf:params:scim:schemas:extension:spend:2.0:Role:roles\",\"value\": [{\"roleName\":\"dynamicAttributes.get('Rolename')\",\"rolesGroup\":\"${entitlementValue.customproperty1}\"}]}]}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
404,
500,
501,
502,
503,
504
]
}
}
]
}

7 REPLIES 7

rushikeshvartak
All-Star
All-Star
  • In add access json you need to have 2 calls 
  • call 1 get users call which will provide id of user 
  • call 2 from user id send for adding access

Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

Rajatlm10
New Contributor III
New Contributor III

@rushikeshvartak 

1. The id gets created at the time of create only. in call1 in add access JSON how will it know which id to return ? 

The issue is id is not getting imported in recon also. otherwise i would have stored it in a CP of account and then use it in call2 for adding access. 

Always account will be created first then access will be added. Hence once account is created in add access call 1 call target api to get id and pass to call2


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

@rushikeshvartak 

Yes, account has already been created thru the create account JSON. 

i am using the get call as call1 in add acess and post/patch in call2. is it the right way ?

Yes


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

Rajatlm10
New Contributor III
New Contributor III

@rushikeshvartak 

is it the right way ? 

 

"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://removed/Users/",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/x-www-form-urlencoded",
"httpMethod": "GET"
},
"listField": "users",
"keyField": "accountID",
"colsToPropsMap": {
"accountID": "id~#~char",
"name": "id~#~char"
},
"disableDeletedAccounts": true
},


"call2": [
{
"connection": "acctAuth",
"url": "https://removed.com/Users/${response.call1.message.id}",
"httpMethod": "PATCH",
"httpParams": "{\"schemas\":[\"urn:ietf:params:scim:schemas:core:2.0:User\"],\"Operations\":[{\"op\": \"add\",\"path\":\"urn:ietf:params:scim:schemas:extension:spend:2.0:Role:roles\",\"value\": [{\"roleName\":\"dynamicAttributes.get('Rolename')\",\"rolesGroup\":\"${entitlementValue.customproperty1}\"}]}]}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
404,
500,
501,
502,
503,
504
]
}
}
]
}

No you are wrong import syntax in get call. You need to search particular user

refer https://forums.saviynt.com/t5/identity-governance/multiple-call-get-and-post-in-same-create-account-...


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.