in reply to Complex filter queries in a REST API

Some people are using graphql, but it's not REST. GET payloads defining filter options is not a bad idea, but with GET people get lazy and start appending query params. With that said, it might be sign that your REST design itself doesn't reflect reality given the need to augment the calls with complexity. But there is also nothing saying that a "query" can't be part of your model - just needs to be incorporated in as high a level as possible. (added) What this question (and the popularity of graphql) tells me is that the underlying data model and the REST model are not coherent with one another. What this also implies is that perhaps what is actually needed is a data abstraction layer since REST really should reveal nothing about the underlying data model itself (e.g., it should provide "data encapsulation" like trad OOP).
  • Comment on Re: Complex filter queries in a REST API

Replies are listed 'Best First'.
Re^2: Complex filter queries in a REST API
by martell (Hermit) on Mar 26, 2021 at 11:38 UTC

    Graphql is bit to far out for my situation, but I agree with your observation that REST tends to expose too much of the underlying model to the client: The client becomes quickly tightly coupled with the underlying data model if you aren't paying attention. I've been bitten by that dog already :)