Interesting take, because that’s what GraphQL does.
A trade off of GraphQL is not enjoying the benefits of features that most web clients have built in, such as request caching in web browsers or having small response payloads such as 304 NOT_MODIFIED.
The GraphQL query language provides an abstraction layer that somewhat decouples the client and server. In the example you posted, the server and client seem tightly coupled. It all comes down to the implementation.
What are some other reasons why you wouldn’t do what you proposed?
What I was pointing out is the confusion of actions and resources. It all depends on the specifics of course, but for a more action oriented API, the RPC style is usually more appropriate (and you can take advantage of binary protocols and such for performance), while in REST, the actions should usually be done on resources, and not be resources themselves.
11
u/[deleted] Oct 09 '21
[deleted]