02/03/2023 04:55 AM - edited 02/03/2023 04:56 AM
HI team,
I am trying to create account using API and i am few issues
API is working fine from Postman but not from saviynt.
Body of the API call is url encoded and data is sent in arrays.
Can some one help me in CreateAccount Json built with the help of Curl out iam sharing?
curl --location --request POST 'https://vault.abc.in/api/rest/json/v1/user/adimport?donotsendmail=true' \
--header 'Authorization: Bearer 1000.xxxxxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cookie: 35e228fe06=19e75f4022e44f6e86aa605bc39717e2; JSESSIONID=96FA179E6896386E31131650777648D1; _zcsr_tmp=99c39ee4-f19e-467b-94c7-319260581894; zvcsr=99c39ee4-f19e-467b-94c7-319260581894' \
--data-urlencode 'INPUT_DATA=[{"username":"test","email":"testdemo@abc.com","enabled":"true","password":"~88uuihihiu0"}]'
I am using below createaccountjson
{
"accountIdPath":"accountName",
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://vault.abc.in//api/rest/json/v1/user/adimport",
"httpMethod":"POST",
"httpParams":"{\"username\": \"${user.username}\", \"email\": \"${user.email}\", \"enabled\":\"false\"}",
"httpHeaders":{
"Authorization":"${access_token}",
"httpContentType":"application/x-www-form-urlencode"
},
"successResponses":{
"message":[
"Successfully sent invitation to the user"
]
}
}
]
}
Response from Postman is
02/03/2023 06:02 AM - edited 02/03/2023 06:19 AM
1. I see httpContentType value has typo, Please correct it.
"httpContentType":"application/x-www-form-urlencoded"
2. Also I don't see password mapping and enabled as false in createAccountJSON. Does your target support creating account in disabled state and with no password? If not i would suggest correcting the mapping as well.
3. I see success response mapping is also not correct modify like below
"successResponses":{
"operation.Details[0].message": "Successfully sent invitation to the user"
}
If you still see issue please share the error msg as well
02/03/2023 12:13 PM
{
"accountIdPath": "accountName",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://vault.abc.in//api/rest/json/v1/user/adimport",
"httpMethod": "POST",
"httpParams": "{\"username\": \"${user.username}\", \"email\": \"${user.email}\", \"enabled\":\"false\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"httpContentType": "application/x-www-form-urlencoded"
},
"successResponses": {
"statusCode": [
200,
201
]
}
}
]
}
02/06/2023 05:37 AM
It's not working. I need to pass the httpParams in arrary. Application accepts the data only in Arrary.
I have tried "httpParams": "[{\"username\": \"${user.username}\", \"email\": \"${user.email}\", \"enabled\":\"false\"}]", But it did not work
02/06/2023 06:24 AM
@saipraveengv : Can you try below
{
"accountIdPath": "accountName",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://vault.abc.in//api/rest/json/v1/user/adimport",
"httpMethod": "POST",
"httpParams": "{\"INPUT_DATA\": \"[{\"username\":\"test\",\"email\":\"testdemo@abc.com\",\"enabled\":\"true\"}]\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"httpContentType": "application/x-www-form-urlencoded"
},
"successResponses":{
"operation.Details[0].message": "Successfully sent invitation to the user"
}
}
]
}
02/06/2023 07:52 AM
@sk failed with {"call1":{"message":"Unexpected character ('u' (code 117)): was expecting comma to separate Object entries\n at [Source: {\"INPUT_DATA\": \"[{\"username\":\"test\",\"email\":\"testdemo@abc.com\",\"enabled\":\"true\"}]\"}; line: 1, column: 21]","status":"Failed"}}
02/06/2023 05:41 PM
"httpParams": "{"INPUT_DATA":[{\"username\": \"${user.username}\", \"email\": \"${user.email}\", \"enabled\":\"false\"}]}"
02/07/2023 03:32 AM
Using
{
"accountIdPath":"accountName",
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://vault.zoho.in/api/rest/json/v1/user/adimport?donotsendmail=true",
"httpMethod":"POST",
"httpParams":"{\"INPUT_DATA\" : [{\"username\": \"${user.username}\", \"password\":\"${password}\",\"email\": \"${user.email}\", \"enabled\":\"false\"}]}",
"httpHeaders":{
"Authorization":"${access_token}",
"httpContentType":"application/x-www-form-urlencoded"
},"httpContentType":"application/x-www-form-urlencoded",
"successResponses":[
{
"operation.Details[0].message":"Successfully sent invitation to the user"
}
]
}
]
}
The json is failing with {"call1":{"message":"Unexpected character (':' (code 58)): was expecting comma to separate Array entries\n at [Source: {\"INPUT_DATA\" : [{\"username\": \"E0025\", \"password\":\"3s6oggfd^\"},\"email\": \"jane.doe3@abc.local\", \"enabled\":\"false\"}]}; line: 1, column: 76]","status":"Failed"}}
02/27/2023 04:20 AM
if i am using
{
"accountIdPath":"accountName",
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://vault.abc.in/api/rest/json/v1/user/adimport?donotsendmail=true",
"httpMethod":"POST",
"httpParams":"{\"INPUT_DATA\":[{\"username\":\"${user.username}\",\"email\":\"${user.email}\",\"enabled\":\"false\",\"password\":\"${password}\"}]}",
"httpHeaders":{
"Authorization":"Bearer ${access_token}",
"Content-Type":"application/x-www-form-urlencoded"
},"httpContentType":"application/json",
"successResponses":[
{
"operation.Details[0].message":"Successfully sent invitation to the user"
}
]
}
]
}
i am getting {"error_code":"EXTRA_PARAM_FOUND","message":"EXTRA_PARAM_FOUND","status":"failed"}}},"statusCode":200,"description":null,"status":"Failed"}} error
if i use {
"accountIdPath":"accountName",
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://vault.abc.in/api/rest/json/v1/user/adimport?donotsendmail=true",
"httpMethod":"POST",
"httpParams":"{\"INPUT_DATA\":[{\"username\":\"${user.username}\",\"email\":\"${user.email}\",\"enabled\":\"false\",\"password\":\"${password}\"}]}",
"httpHeaders":{
"Authorization":"Bearer ${access_token}",
"Content-Type":"application/x-www-form-urlencoded"
},"httpContentType":"application/x-www-form-urlencoded",
"successResponses":[
{
"operation.Details[0].message":"Successfully sent invitation to the user"
}
]
}
]
} i am getting "message":{"operation":{"result":{"error_code":"JSON_PARSE_ERROR","message":"JSON_PARSE_ERROR","status":"failed"}}},"statusCode":200,"description":null,"status":"Failed"}]}
Can you guys help me in solving this. I am not getting solution for this issue.
02/27/2023 10:31 AM
In your Connection can you update the parameter Config json and define the value {"showLogs":true}.
Run the prov job after this and in the logs check for string Calling Webservice Url. This should print the data as it is being sent from Saviynt and share it.
03/01/2023 08:59 AM
HI @sahil ,
I received the below error for extra param found
2023-03-01T22:25:29+05:30-ecm-worker-{"log":"2023-03-01 16:55:29,910 [quartzScheduler_Worker-7] DEBUG rest.RestProvisioningService - Calling Webservice Url - https://vault.abc.in/api/rest/json/v1/user/adimport?donotsendmail=true with httpParams - [INPUT_DATA:[[username:E0016, email:solemen.gupta9@example.com, enabled:false, password=******\n","stream":"stdout","time":"2023-03-01T16:55:29.910967645Z"}
And for JSON Parse error
2023-03-01T22:23:57+05:30-ecm-worker-{"log":"2023-03-01 16:53:56,997 [quartzScheduler_Worker-1] DEBUG rest.RestProvisioningService - Calling Webservice Url - https://vault.abc.in/api/rest/json/v1/user/adimport?donotsendmail=true with httpParams - [INPUT_DATA:[[username:E0016, email:solemen.gupta9@example.com, enabled:false, password=******\n","stream":"stdout","time":"2023-03-01T16:53:56.997606021Z"}
03/03/2023 08:15 AM
Can you try with the below and confirm. If it still does not work, do share the log snippet as before.
"httpParams":"{\"INPUT_DATA\":{\"username\":\"${user.username}\",\"email\":\"${user.email}\",\"enabled\":\"false\",\"password\":\"${password}\"}}",
03/07/2023 12:20 AM
hi @sahil
Same error as before.
2023-03-07T13:48:50+05:30-ecm-worker-{"log":"2023-03-07 08:18:50,044 [quartzScheduler_Worker-8] DEBUG rest.RestProvisioningService - Calling Webservice Url - https://vault.zoho.in/api/rest/json/v1/user/adimport?donotsendmail=true with httpParams - [INPUT_DATA:[username:E0011, email:user11@testmail.com, enabled:false, password=******\u0026biaPiZbl1i6j#!kvKp]]\n","stream":"stdout","time":"2023-03-07T08:18:50.044326963Z"}
03/07/2023 06:52 AM
Can you share the postman collection export of Call2 once.
03/15/2023 01:12 AM
hi @sahil ,
server side logs shows below error
ErrorCode:
JSON_PARSE_ERROR
Unable to parse String : "[{username=E0008, email=user8@testmail.com, enabled=false, password=****}]" to : JSONArray & Exception Message : Expected a ':' after a key at 11 [character 12 line 1]
Any idea what is the issue with :
03/15/2023 07:38 AM
Can you share the postman collection export of Call2 once.
03/16/2023 03:43 AM - edited 03/16/2023 03:43 AM
03/17/2023 09:41 AM
This may require additional troubleshooting. Can you open a ticket with Support for this.