Reputation: 61
I'm calling a PHP REST API from an iOS app to retrieve data from my MySQL database. I wanted to know if there is a size limit on the amount of data I can receive via a HTTP GET request, given that it's serialized as JSON.
Upvotes: 3
Views: 13691
Reputation: 4091
Is there a size limit for HTTP GET requests with JSON bodies?
No, there is no size limit in HTTP, but there might be a limit elsewhere.
HTTP response bodies may have an arbitrary size, though there are several other factors that might enforce a hard limit:
memory_limit
which imposes a limit for the PHP process.In practice, memory_limit
will be the first limit that you will hit. It's usually advisable to use LIMIT
in your SQL queries and paginate the responses. Sending out over, say, 1 MiB of JSON is generally not a very good idea.
Upvotes: 4
Reputation: 46
I believe there are no size limitations with JSON requests. Any direct limitations, however, could be caused or set by the parsing of the request via the server. Therefore, it's possible to think that perhaps the MySQL DB itself may have some. Hope this helps!
Upvotes: 1