86

We are thinking of using a REST interface for communication between internal apps. App A will have to pass a fair bit of data representing a financial portfolio to app B. Is there any limit to the amount of data that can be passed using a REST API given that REST is implemented using HTTP? I wasn't sure if another protocol (ie: RMI) should be used with a large data set.

Marcus Leon
  • 55,199
  • 118
  • 297
  • 429

2 Answers2

83

No, it's pretty much up to the server implementation if there's any such limit.

There's a limit on the size of a URL (if you wish to put large amounts of data on the URL, like with a GET), but no defined limit for a POST or PUT.

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
  • 13
    That's true, but I'd like to add that, for large posts and over significant latencies, performance may become an issue, if only because of TCP/IP's limitations. The typical work-around is to upload multiple parts in parallel. – Steven Sudit Sep 30 '09 at 00:29
56

As Will Hartung said, there is no limit in the standard (RFC 2616). But every implementation has its own limits. A few examples:

These implementation limits are usually just the default configuration values, and can be changed to larger ones if required.

Community
  • 1
  • 1
bortzmeyer
  • 34,164
  • 12
  • 67
  • 91
  • 3
    I don't think this is correct, at least for Tomcat. maxPostSize only affects payloads with content type application/x-www-form-urlencoded. I suspect the PHP answer has the same limitation, though Apache's LimitRequestBody does seem to do what is being requested. – fool4jesus Jan 11 '13 at 19:07
  • And what is the limit on GET response size? Same as for POST? – Kysil Ivan Jun 26 '17 at 20:02
  • 1
    From PHP documentation: `Allow unlimited post size by setting post_max_size to 0.` – Janac Meena Jan 07 '19 at 15:16