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

How to pass role/Entitlement values dynamically inside the createaccount json.

mahammed_raffi
New Contributor
New Contributor

Hi Team,

We are getting the response from one of the REST api for CreateUser, Which included the UserDetails and RoleDetails in same api https://localhost:3780/api/3/users
but the issue when we try to call the CreateAccount JSON with out role details we are getting error from the postman, which mean to create account is not allowing without role details. In this case how can we pass the role details into the createaccount JSON dynamically.

Sample CreateUser API response as below:

{
"authentication": {
"id": "2",
"type": "normal"
},
"email": "test12@test.com",
"enabled": true,
"locale": {
"default": "",
"links": [
{
"href": "XXXXXXX/api/3/users",
"rel": "self"
}
],
"reports": "en-US"
},
"login": "XXXXXXX",
"name": "XXXXXXXXX",
"password": "XXXXXXXX",
"passwordResetOnLogin": false,
"role": {
"allAssetGroups": false,
"allSites": false,
"id": "View Only",
"superuser": false

}

}

Please find the below CreateAccount JSON which we are trying to hardcode the role attribute value as "View Only". Any suggestion how to pass the role value dynamically, as we have list of roles we are getting in the response.

{
"accountIdPath": "accountName",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"showResponse": false,
"url": "XXXXXXXXXX/user-api/users",
"httpMethod": "POST",
"httpParams": "{\"active\": \"true\", \"eid\": \"${user.username}\", \"email\": \"${user.email.toLowerCase()}\", \"firstName\": \"${user.firstname}\", \"lastName\":\"${user.lastname}\", \"name\":\"${user.firstname+' '+user.lastname}\", \"role\":\"View Only\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
201,
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404
]
}
}
]
}

4 REPLIES 4

Raghu
Honored Contributor
Honored Contributor

@mahammed_raffi  Sample below

"acctEntMappings": {
"Roles": {
"importAsEntitlement": true,
"listPath": "roles",
"idPath": "id",
"keyField": "entitlementID",
"colsToPropsMap": {
"entitlementID": "id~#~char",
"entitlement_value": "name~#~char",
"customproperty1": "description~#~char"
}
}
}
},
"entitlementParams": {
"connection": "acctAuth",
"processingType": "SequentialAndIterative",
"entTypes": {
"Roles": {}
}
},
"acctEntParams": {
"processingType": "acctToEntMapping"
}
}

 

https://forums.saviynt.com/t5/identity-governance/import-coupa-roles-entitlements/m-p/70113

 


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

rushikeshvartak
All-Star
All-Star

You can't fetch Entitlement/Role information in createaccount you need to create dynamic attribute for this purpose and use in createaccount  json


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

mahammed_raffi
New Contributor
New Contributor

Hi Rushikesh, 

Can you please provide any sample createaccount json which similar to above use case ?

I have tried with the below and it didn't work somehow.
CreateAccount Json :
{
"accountIdPath": "accountName",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"showResponse": false,
"url": "XXXXXXXXXXX/api/3/users",
"httpMethod": "POST",
"httpParams": "{\"authentication\":{ \"id\":\"2\", \"type\":\"normal\" },\"email\":\"${user.email}\", \"enabled\":\"true\", \"login\":\"${user.username}\",\"name\":\"${user.username}\",\"password\":\"XXXXX\",\"passwordResetOnLogin\":\"true\",\"role\":{ \"allAssetGroups\":\"false\", \"allSites\":\"false\", \"id\":\"${requestAccessAttributes.get('User_Role')}\", \"superuser\":\"false\"}}",
"httpHeaders": {
"Authorization": "Basic c2F2aXludGFwaXVzZXI6V2VsY29tZUAxMjM="
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
201,
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404
]
}
}
]
}

 

Let me know any modifications we need to do for above createaccount json.. 

Its correct format . Please share logs if you facing issue.


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