سؤال

I want to POST with a payload. The payload is a zip file. The way I am used to posting is to type raw text into the payload. But I'm not sure how to approach putting a file inside of the payload. Is it possible to somehow convert the zip file into text and then post that?

هل كانت مفيدة؟

المحلول

You basically need to send the file contents as part of the POST body. You may also want to send some metadata about the file. In that case, you should use either Multipart/Form or Multipart/Mixed content types. Basically it allows you to have different kind of data in your POST body.

Here is a very good and simple tutorial to help you learn how to upload a file to a RESTful service:

http://www.mkyong.com/webservices/jax-rs/file-upload-example-in-jersey/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top