The right way to upload large RESTful files

I have been doing a REST API for some time, and I'm still listening to one case - a large file upload. I read several other APIs such as Google Drive, Twitter, and other literature, and I have two ideas, but I'm not sure if they are "correct." As normal, I mean that it is somewhat standardized, there is not much client logic (since other parties will implement this client), or even better, it could be easily called using cURL. The plan is to implement it in Java, preferably in the Play Framework.

Obviously, I will need some file separation and server-side buffering, as the files are large.

So, the first solution I have is multi-page loading ( multipart/form-data). I get this path, and I implemented it the way I did before, but it was always strange for me to emulate the form on the client side, especially since the client must set the file key name, and, in my experience, this is something that kind of clients forget or do not understand. In addition, how is the size / lot size dictated? What makes the client completely put the whole file in one piece?

Solution two, at least what I understood, but not finding a real implementation implementation, is that a “regular” POST request can work. Content should be flagged and data buffered on the server side. However, I am not sure if this is the correct understanding. How is the data actually fragmented, does the download support multiple HTTP requests, or is it tagged at the TCP level? What is Content-Type?

At the bottom, which of the two (or something else?) Should be a user-friendly, widely understood way to implement the REST API for downloading files?

+9
source share
2 answers

Amazon S3 Rest API . .

Amazon :

  1. , API .

  2. ( ), , md5 ; HTTP-. API , md5 md5, , , . API ( ) . API , , , , .

  3. , ( ), API. API , , .

Amazon , . - , , .

, , , . , , .

, REST API , . , , , .

+4
0

Source: https://habr.com/ru/post/1617206/


All Articles