guettli guettli - 2 years ago 95
HTTP Question

Which http request method for web API which receives big files

Which http request method is suitable to receive big files?

My use case: I want to provide a HTTP API:

  • Input: mp3 file. The whole file (not just the file name)

  • Output: List of possible music interpreter singing this song.

Since no data gets modified on the server I think
don't fit.

AFAIK the method
does not fit:

  • the mp3 file is too big for the query-string.

  • GET-requests with data in the body are new to me.

Which http request method for web API which receives big files?


  • This is not an upload. The mp3 is the input, some text is the output.


Imagine you want to provide a HTTP API for
. If you input
you receive
. Would you use the word "upload" for the number
? Where to draw a line between normal GET and big GET?

Answer Source

To send the content of a file to the server, you should use a POST request:

4.3.3. POST

The POST method requests that the target resource process the representation enclosed in the request according to the resource's own specific semantics. For example, POST is used for the following functions (among others):

  • Providing a block of data, such as the fields entered into an HTML form, to a data-handling process; [...]

The content of the file will be sent in the payload of the request and the Content-Type of the request should be set to multipart/form-data.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download