GET endpoint with potentially thousands of query string parameters


#1

x-post from my StackOverflow question, I thought I’d ask here as this seems more active than StackOverflow:

Hello there!

I am building some JSON API endpoints which could take potentially thousands of query string parameters. Something which concerns me is the artificial limits set per browser, highlighted in this answer

I know I could convert my GET endpoints to POST endpoints, but this is breaking the JSON API specification as far as I can tell. Has anyone else had to work around this restriction?


#2

That depends on how you do it.
Just POSTing to /resources?filter[a]=1&filter[b]=5... to retrieve the data is arguably non-compliant.
But there’s nothing stopping you from creating a “filtered resources” representation: i.e. POST to /filteredResources with params in the body to create a new resource representation that is a subset of /resources. You lose a lot of caching benefits, but that might not matter depending on what you’re doing.