Hacker News new | ask | show | jobs
by wmdmark 3027 days ago
That's true however at that point our API is not longer "RESTfull" and become very ad hoc. The cool thing we found with GraphQL is that the client can control the shape of the data it needs without any server side changes (assuming your schema exposes everything properly).
3 comments

> The cool thing we found with GraphQL is that the client can control the shape of the data it needs without any server side changes.

This is the single biggest advantage of GraphQL and AFAIK one of the main reasons for it's conception.

> That's true however at that point our API is not longer "RESTfull" and become very ad hoc.

So.... That's why you decide to create ad-hoch APIs using GraphQL queries instead: "the client can control the shape of the data it needs"

Why is returning say the three top comments not RESTful?
Because in rest, urls are supposed to specify a resource, but now your response is a resource and some other resources too.

Not saying that being pure to rest ideology is a good thing. I think it’s a terrible fit for most applications more complex than a demo todo app

There's nothing "impure" about that. From Fielding's dissertation (emphasis mine):

"The key abstraction of information in REST is a resource. Any information that can be named can be a resource: a document or image, a temporal service (e.g. "today's weather in Los Angeles"), a collection of other resources, a non-virtual object (e.g. a person), and so on."

By the way, REST is not an ideology, it's an architectural style. It defines a set of constraints, and specifies the advantages and disadvantages of applying each of them.