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

Pass urlencoded data in API body

saipraveengv
New Contributor III
New Contributor III

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 

 

saipraveengv_0-1675428888523.png

 

17 REPLIES 17

sk
All-Star
All-Star

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


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

rushikeshvartak
All-Star
All-Star
{
  "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
        ]
      }
    }
  ]
}

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

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

@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"
     }
    }
  ]
}

 


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

saipraveengv
New Contributor III
New Contributor III

@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"}}

 

 

"httpParams": "{"INPUT_DATA":[{\"username\": \"${user.username}\", \"email\": \"${user.email}\", \"enabled\":\"false\"}]}"


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

saipraveengv
New Contributor III
New Contributor III

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"}}

saipraveengv
New Contributor III
New Contributor III

HI @rushikeshvartak @sk 

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.

SB
Saviynt Employee
Saviynt Employee

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.


Regards,
Sahil

saipraveengv
New Contributor III
New Contributor III

HI @SB ,

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"}

SB
Saviynt Employee
Saviynt Employee

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}\"}}",


Regards,
Sahil

saipraveengv
New Contributor III
New Contributor III

hi @SB 

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"}

SB
Saviynt Employee
Saviynt Employee

Can you share the postman collection export of Call2 once.


Regards,
Sahil

saipraveengv
New Contributor III
New Contributor III

hi @SB ,

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 :

SB
Saviynt Employee
Saviynt Employee

Can you share the postman collection export of Call2 once.


Regards,
Sahil

saipraveengv
New Contributor III
New Contributor III
--header 'Authorization: Bearer xxxxxxxxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cookie: 35e228fe06=19e75f4022e44f6e86aa605bc39717e2; JSESSIONID=ABBFF1818B5A9B537EC7ACB2DEA98D99; _zcsr_tmp=27756abd-3a46-47a9-b83e-11c4c35e94c5; zvcsr=27756abd-3a46-47a9-b83e-11c4c35e94c5' \
--data-urlencode 'INPUT_DATA=[["username":"testWithpostman","email":"testWithpostman@zvaultdemo.com","enabled":"false","password":"~e&h28ve7YG&EkK0"]]'

SB
Saviynt Employee
Saviynt Employee

This may require additional troubleshooting. Can you open a ticket with Support for this.


Regards,
Sahil