I have hit a REST API which consumes multipart/mixed
data with a payload but the REST API takes it as a string. If I try other Object as Multipart
, RequestPart then it throws a 415 UnsupportedMediaType Exception
.
This is the multipart/mixed
payload which I have passed:
POST /users/jsonform HTTP/1.1
Content-Type: multipart/mixed; boundary=----------boundary
Content-Length: 963
----------boundary
Content-Length: 337
Content-Type: application/json
content-id: 1
GET http://localhost:9090/users/user/1
----------boundary
Content-Length: 353
Content-Type: application/json
content-id: 2
content-transfer-encoding: binary
POST http://localhost:9090/users/addUser
{
"firstName": "Test",
"lastName": "Test"
}
----------boundary--
@POST
@Path("/jsonform")
@Consumes("multipart/mixed")
public void simpler(String inputs) throws MessagingException, IOException {
System.out.println(inputs);
}
If I pass a string argument it reads the payload as a string but If I pass anything other than string, then its throws an error.
I am getting the error:
HTTP Status [415] – [Unsupported Media Type]