How to POST a request in any of rest clients for m

2019-07-27 05:30发布

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条回答
Explosion°爆炸
2楼-- · 2019-07-27 06:06

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

查看更多
我只想做你的唯一
3楼-- · 2019-07-27 06:16

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.

查看更多
登录 后发表回答