How to upload large files to a server using HTTP REST API?

Hello,

I am trying to learn how to upload a large file (video/audio) to the server using the HTTP REST API endpoint.

What I have learned so far are the following. Could you please correct me if I am wrong and share any additional knowledge? I would like to learn all the supported approaches and choose the most robust option that is widely supported for large video/audio file upload.

option1: (does not work with video or audio files)

content-type: application/x-www-form-urlencoded

the content type is specified in the request header. The data is transferred as key-value pair separated by '&'. However, the nonalphanumeric characters are percent-encoded which makes it not suitable to transfer binary data (video/audio files might get corrupted).

/v1/videos method: POST host: YouTTTube-com content-type: application/x-www-form-urlencoded content-length: 134566 field1=xy&filed2=uyt 

option2: (might be the best option)

content-type: multipart/form-data

the value is split into chunks and separated by a user-agent-defined delimiter ("boundary"). The keys are given in the "content-disposition" header of each part/chunk.

/v1/videos method: POST host: YouTTTube-com content-type: multipart/form-data; boundary="--boundary" --boundary content-disposition:form-data; name="field1"; filename="myvideo.mp4" content-type: "video/mp4" --boundary content-disposition:form-data; name="field2";filename="myvideo.mp4" content-type: "video/mp4" 

Please let me know your thoughts. What are other options? What is wrong with the above options?

submitted by /u/git_world
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/blTi6kQ

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close