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

Rest connector create account json failing with error

VijayMaram
Regular Contributor
Regular Contributor

Hi Team,

We are facing error while creating account using rest api.

 

ConnectionJSON: 

{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https:*****/oauth/token",
"httpMethod": "POST",
"httpParams": {
"grant_type": "client_credentials",
"client_secret": "*****",
"client_id": "****",
"resource": "https://*******"
},
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"InvalidAuthenticationToken"
],
"timeOutError": "Read timed out",
"errorPath": "error.code",
"retryFailureStatusCode": [],
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"accessToken": "Bearer abc"
}
}
}

 

CreateAccountJSON:

{
"accountIdPath": "call1.message.Id",
"call": {
"name": "call1",
"connection": "acctAuth",
"url": "https*****/api/v2/scim/users",
"httpParams": "{\"userName\": \"${user.email}\", \"active\": true, \"displayName\": \"${user.displayname}\",\"externalId\": \"${user.username}\",\"emails\": [{\"primary\": true, \"value\": \"${user.email}\", \"type\": work},{\"primary\": false, \"value\": \"${user.email}\", \"type\": other}]}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"httpMethod": "POST",
"successResponses": {
"statusCode": [
200,
201,
204
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
404,
409,
500,
501
]
}
}
}

 

We were able to create account using postman.

17 REPLIES 17

VijayMaram
Regular Contributor
Regular Contributor

VijayMaram_0-1723477778951.png

 

SumathiSomala
All-Star
All-Star

@VijayMaram is your accountIdPath mapping correct?

share the postman response

 

Regards,
Sumathi Somala

If this reply answered your question, please Accept As Solution and give Kudos.

{
"id": "a72ae9b4-599f-4d3e-8beb-f5cb34540da39c1a",
"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:genesys:purecloud:2.0:User"
],
"active": true,
"userName": "km.****@****.com",
"displayName": "km.****@****.com",
"emails": [
{
"value": "km.****@****.com",
"type": "other",
"primary": false
},
{
"value": "km.****@****.com",
"type": "work",
"primary": true
}
],
"externalId": "A77772K",
"roles": [
{
"value": "employee"
}
],
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"division": "Home"
},
"urn:ietf:params:scim:schemas:extension:genesys:purecloud:2.0:User": {
"externalIds": [
{
"authority": "x-pc:scimv2:v1:c81202d2-e4ed-4a34-8266-33b656897888c3740",
"value": "A17*****K"
}
]
},
"meta": {
"resourceType": "User",
"lastModified": "2024-08-12T15:23:38.000Z",
"location": "/api/v2/scim/v2/users/a72ae9b4-599f-4d3e-8beb-f5cb034645654da39c1a",
"version": "W/\"3\""
}
}

rushikeshvartak
All-Star
All-Star
  • Did you add json in proper location? The error says createNewUser

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

@rushikeshvartak 

Yeah, i am using correct place. createAccountJSON.

{
  "accountIdPath": "call1.message.Id",
  "call": {
    "name": "call1",
    "connection": "acctAuth",
    "url": "https*****/api/v2/scim/users",
    "httpParams": "{\"userName\": \"${user.email}\", \"active\": true, \"displayName\": \"${user.displayname}\",\"externalId\": \"${user.username}\",\"emails\": [{\"primary\": true, \"value\": \"${user.email}\", \"type\": \"work\"},{\"primary\": false, \"value\": \"${user.email}\", \"type\": \"other\"}]}",
    "httpHeaders": {
      "Authorization": "Bearer ${access_token}",
      "Content-Type": "application/json"
    },
    "httpContentType": "application/json",
    "httpMethod": "POST",
    "successResponses": {
      "statusCode": [
        200,
        201,
        204
      ]
    },
    "unsuccessResponses": {
      "statusCode": [
        400,
        403,
        401,
        404,
        409,
        500,
        501
      ]
    }
  }
}

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

No Luck, getting same error.

Share latest logs in text file

 

 


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

Hi @rushikeshvartak 
Thanks for checking this.


Please find attached logs.

"2024-08-12T19:23:15.895+00:00","ecm-worker","rest.RestProvisioningService","quartzScheduler_Worker-3-8vmjf","ERROR","Error in createNewUser:: "
"2024-08-12T19:23:16.401+00:00","ecm-worker","","null-8vmjf","","groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.util.HashMap(java.util.LinkedHashMap$Entry) at com.saviynt.provisoning.rest.RestProvisioningService.createNewUser(RestProvisioningService.groovy:2696) at com.saviynt.provisoning.rest.RestProvisioningService$_createAccount_closure14.doCall(RestProvisioningService.groovy:2169) at com.saviynt.provisoning.rest.RestProvisioningService.createAccount(RestProvisioningService.groovy:2002) at com.saviynt.ecm.services.ArsTaskService.createAccountTarget(ArsTaskService.groovy:11842) at com.saviynt.ecm.services.ArsTaskHelperService$_whenTaskTypeIsThreeNewAccountAccess_closure50.doCall(ArsTaskHelperService.groovy:3078) at com.saviynt.ecm.services.ArsTaskHelperService.whenTaskTypeIsThreeNewAccountAccess(ArsTaskHelperService.groovy:3069) at com.saviynt.ecm.services.ArsTaskHelperService$_completeAutoProvTasksUpgraded_closure1.doCall(ArsTaskHelperService.groovy:175) at com.saviynt.ecm.services.ArsTaskHelperService.completeAutoProvTasksUpgraded(ArsTaskHelperService.groovy:160) at MultipleProvisioningJob.execute(MultipleProvisioningJob.groovy:222) at org.quartz.core.JobRunShell.run(JobRunShell.java:199) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)"

 

Updated JSON

{
  "accountIdPath": "call1.message.Id",
  "call": {
    "name": "call1",
    "connection": "acctAuth",
    "url": "https*****/api/v2/scim/users",
    "httpParams": "{\"userName\": \"${user.email}\", \"active\": true, \"displayName\": \"${user.displayname}\",\"externalId\": \"${user.username}\",\"emails\": [{\"primary\": true, \"value\": \"${user.email}\", \"type\": \"work\"},{\"primary\": false, \"value\": \"${user.email}\", \"type\": \"other\"}]}",
    "httpHeaders": {
      "Authorization": "${access_token}",
      "Content-Type": "application/json"
    },
    "httpContentType": "application/json",
    "httpMethod": "POST",
    "successResponses": {
      "statusCode": [
        200,
        201,
        204
      ]
    },
    "unsuccessResponses": {
      "statusCode": [
        400,
        403,
        401,
        404,
        409,
        500,
        501
      ]
    }
  }
}

 

If above does not works then please share screenshot from connection that JSON is added in correct location and also try with hardcoded value 


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

VijayMaram_0-1723564685671.png

I have tried passing same values manually, token also passed manually. Still seeing same issue.

Please share postman screenshot and curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]



⚠️‼️‼️Do not upload any attachments that contain sensitive information, such as IP Addresses, URLs, Company/Employee Names, Email Addresses, etc.‼️‼️⚠️


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

Curl information: 

--data-raw '{
  "userName": "km.***i@email.com",
  "active": true,
  "displayName": "km.***i@email.com",
  "externalId": "A17****872K",
  "emails": [
    {
      "primary": true,
      "value": "****.com",
      "type": "work"
    },
    {
      "primary": false,
      "value": "****.com",
      "type": "other"
    }
  ]
}'
VijayMaram_0-1723565927866.png

 

Response: 

{
"id": "a72ae9b4-599f-4d3e-8beb-f5cb34540da39c1a",
"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:genesys:purecloud:2.0:User"
],
"active": true,
"userName": "km.****@****.com",
"displayName": "km.****@****.com",
"emails": [
{
"value": "km.****@****.com",
"type": "other",
"primary": false
},
{
"value": "km.****@****.com",
"type": "work",
"primary": true
}
],
"externalId": "A77772K",
"roles": [
{
"value": "employee"
}
],
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"division": "Home"
},
"urn:ietf:params:scim:schemas:extension:genesys:purecloud:2.0:User": {
"externalIds": [
{
"authority": "x-pc:scimv2:v1:c81202d2-e4ed-4a34-8266-33b656897888c3740",
"value": "A17*****K"
}
]
},
"meta": {
"resourceType": "User",
"lastModified": "2024-08-12T15:23:38.000Z",
"location": "/api/v2/scim/v2/users/a72ae9b4-599f-4d3e-8beb-f5cb034645654da39c1a",
"version": "W/\"3\""
}
}

{
  "accountIdPath": "call1.message.Id",
  "call": {
    "name": "call1",
    "connection": "acctAuth", 
    "url": "https://api.usw2.pure.cloud/api/v2/scim/users",
    "httpParams": {
      "userName": "${user.email}",
      "active": true,
      "displayName": "${user.displayname}",
      "externalId": "${user.username}",
      "emails": [
        {
          "primary": true,
          "value": "${user.email}",
          "type": "work"
        },
        {
          "primary": false,
          "value": "${user.email}",
          "type": "other"
        }
      ]
    },
    "httpHeaders": {
      "Authorization": "${access_token}",
      "Content-Type": "application/json"
    },
    "httpContentType": "application/json",
    "httpMethod": "POST",
    "successResponses": {
      "statusCode": [
        200,
        201,
        204
      ]
    },
    "unsuccessResponses": {
      "statusCode": [
        400,
        403,
        401,
        404,
        409,
        500,
        501
      ]
    },
    "authError": [
      "InvalidAuthenticationToken",
      "AuthenticationFailed"
    ],
    "errorPath": "error",
    "retryFailureStatusCode": [401],
    "timeOutError": [408],
    "expiryError": "token_expired",
    "maxRefreshTryCount": 5
  }
}

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

VijayMaram
Regular Contributor
Regular Contributor

@rushikeshvartak  Yes, i am using correct location. Let me try above suggestions. Will let you know results.

VijayMaram
Regular Contributor
Regular Contributor

Hi @rushikeshvartak  @SumathiSomala 

The issue is with the connectionJSON. I have fixed it and now it's working fine.

Share working json to help others


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