I've heard the recommendation of using POST
in such circumstances, but not to merely accept parameters.
Instead, a POST
request is fired with the complex filtering data as the message body, and this predictably creates a resource; let's call it a search
:
POST /search HTTP/1.1
The response identifies via Location
the result set:
Location: http://example.com/search/798342
A subsequent GET
request can be made against the location, returning the result set. This works particularly well when the result set may take some time to generate (which could be the case given complex filtering rules) and maintains alignment with the expectations of HTTP.
GET /search/798342 HTTP/1.1
If the search results are not ready, yield a 404
.
Searches, like anything else, can/should be represented as resources. An added benefit is caching. If you cache the results of a complex operation, the cache lifetime can be communicated from the search result set resource.