Click HERE to see how Saviynt Intelligence is transforming the industry. |
04/20/2023 06:20 AM
Team, I need to send a Request Body for account creation as multipart/form-data to an application as it accepts only data in this format. I have configured the contenttype accordingly but it does not seem to work. Below is the CREATEACCOUNTJSON and Postman request. Please can you advise how can I successfully send this multipart request? When I am using the below specified JSON, I am getting the error - {"status":"FAIL","code":470,"errors":"Multipart message request is invalid. ParameterRequest body content type should be 'application/json'."}, cookies:[useractivity_cookie_mingle=1681993849; secure; httponly; path=/; domain=inforcloudsuite.com; SameSite=Lax], statusCode:400]
But if I send the request as application/json, then it says unsupported Media Format. ("errormessage":"Requested Media type is : application/json, OutboundJaxrsResponse{status=415, reason=Unsupported Media Type)
Here is the JSON and the postman call, ( ON postman both the parameters are being send as form-data)
{
"accountIdPath": "accountName",
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "***************",
"httpMethod": "POST",
"httpParams": "{\"ParameterRequest\": [{}],\"MessagePayload\": [{\"AddUser\": {}}]}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "multipart/form-data",
"successResponses": {
"statusCode": [
200,
201,
202
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404,
408,
412,
500
]
}
}
]
}
04/20/2023 11:13 AM
Can you share the postman export of this call.
04/21/2023 01:15 AM
04/24/2023 01:25 AM
@SB / Team - Any advise on this please ? I am still having issue sending data as form-data from Saviynt
04/24/2023 07:47 AM
Can you try with the below format and see if it works
"httpContentType": "form-data" OR
"httpContentType": "formdata"
04/25/2023 12:05 AM
Thank you @SB . I am now getting a 400 Bad request error and a bad constructor error while trying with either of the above httpcontenttype. Here is the JSON payload. Please can you advise if anything is wrong here?
{
"accountIdPath": "accountName",
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://**************/multipartMessage",
"httpMethod": "POST",
"httpParams": "{\"ParameterRequest\": [{\"documentName\": \"Saviynt_AddUser_JSON\",\"messageId\": \"2023-04-20 11:40:53.0\",\"fromLogicalId\": \"lid://abc.123.saviynt_iam_api\",\"toLogicalId\": \"lid://abc.123.saviynt_iam_api\",\"encoding\": \"NONE\",\"characterSet\": \"UTF-8\",\"accountingEntity\": \"*\",\"documentId\": \"2023-04-20 11:40:53.0\",\"source\": \"Saviynt\"}],\"MessagePayload\": [{\"AddUser\": [{\"FirstName\": \"abc\",\"LastName\": \"xyz\",\"email\": \"abc.xyz@domain.com\",\"role\": \"test-role\",\"employeeId\": \"12345\"}]}]}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "form-data",
"successResponses": {
"statusCode": [
200,
201,
202
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404,
408,
412,
500
]
}
}
]
}
Error:
2023-04-25 06:51:59,260 [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService - Exception while iterating Http Map instance
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.lang.String(java.util.ArrayList)
<td>HTTP ERROR: 400 Bad Request
<p>Problem accessing /*************/multipartMessage
<pre id="message">Bad Request</pre>
</p>
</td>
</tr>
</table>
<hr />
<div id="ef">Infor ION Grid - Copyright © 2009-2023 Infor.</body>
</html>
04/25/2023 01:18 AM
I figured that the square brackets were giving the json constructor error. I corrected that and send the payload with httpcontenttype as both 'form-data' and 'formdata' but still get the 400 bad request error
04/25/2023 02:29 AM
@SB Here is the payload I am sending and getting the 400 response
{
"accountIdPath": "accountName",
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://**************/multipartMessage",
"httpMethod": "POST",
"httpParams": "{\"ParameterRequest\": {\"documentName\": \"Saviynt_AddUser_JSON\",\"messageId\": \"2023-04-20 11:40:53.0\",\"fromLogicalId\": \"lid://abc.123.saviynt_iam_api\",\"toLogicalId\": \"lid://abc.123.saviynt_iam_api\",\"encoding\": \"NONE\",\"characterSet\": \"UTF-8\",\"accountingEntity\": \"*\",\"documentId\": \"2023-04-20 11:40:53.0\",\"source\": \"Saviynt\"},\"MessagePayload\": {\"AddUser\": {\"FirstName\": \"abc\",\"LastName\": \"xyz\",\"email\": \"abc.xyz@domain.com\",\"role\": \"test-role\",\"employeeId\": \"12345\"}}}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "formdata",
"successResponses": {
"statusCode": [
200,
201,
202
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404,
408,
412,
500
]
}
}
]
}
</td>
<td>HTTP ERROR: 400 Bad Request
<p>Problem accessing /***********/multipartMessage
<pre id="message">Bad Request</pre>
</p>
</td>
</tr>
</table>
<hr />
04/25/2023 04:26 AM
I am also observing that the data we are sending as 'multipart/form-data' is somehow getting received as 'Plain/Text' at the endpoint. Is there a best way to handle this on Saviynt ?
04/26/2023 10:40 AM
Can you check for the logs for the string (from Calling Webservice Url to Got Webservice API Response) and share.
04/26/2023 11:11 PM
@SB I have attached 2 log files. One while trying with httpcontenttype - 'multipart/form-data' and other with httpcontenttype - 'formdata'. thank you
04/30/2023 11:53 PM
@SB can you please let me know if there is anything else that can be done to send data as 'form-data' ? I had attached the logs as requested
05/01/2023 08:28 AM
Can you update httpHeaders in JSON as below and then try with form-data.
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json",
"Content-Type": "application/octet-stream"
}
05/03/2023 07:14 AM
@SB , thanks for your response. Unfortunately it still does not work. It gives the ' Unsupported Media Type,' error in the Webservice API Response.
{
"accountIdPath": "accountName",
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "",
"httpMethod": "POST",
"httpParams": "{}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json",
"Content-Type": "application/octet-stream"
},
"httpContentType": "form-data",
"successResponses": {
"statusCode": [
200,
201,
202
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404,
408,
412,
500
]
}
}
]
}
05/08/2023 04:34 AM
Team, it is observed that when we send the data as multipart/form-data from Saviynt, at the endpoint, the multipart content types are somehow being received as 'text/plain'. Is there any way to control it ? adding the content type under headers does not help it
06/08/2023 08:34 AM
I wanted to check if this is still an issue or was it resolved.