How to POST a request in any of rest clients for mime type as "multipart/related"

4.1k Views Asked by At

I'm trying to do a POST request from any of rest client like (Advanced rest client, Postman etc) for posting a request with mime type "multipart/related" but none of rest client supports. So is there a way to quickly POST a request from any of rest clients or other alternate solutions?

2

There are 2 best solutions below

1
On

Though I have not tried multipart/related, but multipart/mixed using jersey client.
Using Jersey client

Create a multipart request .. eg.

MultiPart multiPart = new MultiPart();
 multiPart.bodyPart(....//

Then call the service like :

Client c = Client.create();
WebResource service = c.resource(Url);
ClientResponse response = service.type("multipart/mixed").header(headerkey,
            headervalue).post(ClientResponse.class, multiPart);

Similarly try it for multipart/related.
you have download jersery client jar from https://jersey.java.net/download.html

0
On

Using Advance Rest Client Plugin in Chrome

Attached image will help you, This way you can try using Advance Rest Client plugin in Chrome, and also don't forget to upload the file under the Files tab.