Timeline for How do searches fit into a RESTful interface?
Current License: CC BY-SA 4.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 17, 2021 at 9:49 | comment | added | Rhubarb | the reality is that Fielding's REST dissertation was written in the days when html ruled, and HATEOAS made a lot of sense. Today, very few "REST" APIs use (or need) HATEOAS and REST has really become a more expressive form of RPC. Unsurprisingly, the vocabulary of HTTP doesn't fit 1-1 with every use case we have when building a "RESTful" API. This is one of those cases. So every answer is an opinion or workaround. Hence my upvote for this answer. Deal with it, or use GraphQL or gRPC. | |
| Dec 23, 2020 at 16:57 | comment | added | jdkealy | I'm so sick of pedantic approaches to REST. I like to query with JSON, putting JSON in the URL is cumbersome and has its own problems. If POST works it works, there's no debate. It's a preference. If you're using some autogen REST generator, then sure, have the debate, otherwise don't @ me with Martin Fowler quotes. Think outside the box. | |
| Jan 31, 2019 at 1:53 | history | edited | iteratingself | CC BY-SA 4.0 | added 1234 characters in body |
| Jan 30, 2019 at 5:20 | comment | added | ymajoros | @stevendesu in some cases, I actually do (kind of favorites, accessible from a menu). There is no reason I would suddenly use something else when I don't. A new search is being created, whether I save it or not. GET is too restricted for complex searches anyway. We just lack a better method for searches. | |
| Jan 29, 2019 at 13:52 | comment | added | stevendesu | @ymajoros Unless you're saving the search terms and the results of the search somewhere, I don't know that POST makes sense semantically. When you perform a search you're making a request for information, you aren't providing new information to be retained anywhere. | |
| Jan 28, 2019 at 6:50 | comment | added | ymajoros | @stevendesu exactly, that's why I use POST for both (creating a search) :-) | |
| Jan 21, 2019 at 19:07 | comment | added | user13796 | Yes there is, a filter is based on existing fields. A search may contain much more complex patterns, combining fields, computing adjecent values etc. | |
| May 1, 2018 at 10:10 | comment | added | Nicholas Shanks | There is no difference between "filtering" and "searching". | |
| Aug 5, 2015 at 17:17 | comment | added | stevendesu | Since REST is intended to abstract away the underlying implementation (e.g. - a resource is not necessarily a row in a database or a file on a hard drive, but could be anything) I don't know that it necessarily makes sense to use POST over GET when it comes to performing SQL joins. Suppose you have a table of schools and a table of children and you want a class (one school, multiple children). You could easily define a virtual resource and GET /class?queryParams. From the perspective of a user the "class" was always a thing and you didn't have to do any weird SQL joins. | |
| Mar 24, 2014 at 7:10 | history | answered | iteratingself | CC BY-SA 3.0 |