DEV Community

Discussion on: Rest vs. GraphQL: A Critical Review

Collapse
 
gdenn profile image
Dennis Groß (he/him)

I never worked with a clean REST API, they all end up being "so called REST".

I believe that has nothing to do with engineers being not qualified. The problem is that REST is just an idea and not a technology whose constraints get enforced.

And that's where alternatives like GRPC and GraphQL come into play. They do enforce constraints on you. And that's great, that makes an API easier to understand.

Personally, I think there is only two reasons to use REST in 2021:

(1) APIs that we built for the usage by third parties. Neither GraphQL nor GRPC are the standard now, so it is likely that your customers -/ users are more comfortable using REST APIs.

(2) APIs that exchange very generic data. Using JSON along with a backend written in a scripting language makes it easy to work with generic data APIs. On the other hand, it is challenging to find good abstraction types in Protobuf or GraphQL for generic data types.

When it comes to choosing GraphQL vs GRPC, I tend to go with GRPC for functional APIs and GraphQL for data APIs.

Collapse
 
amorriscode profile image
Anthony M.

Great points @gdenn ! I totally agree with you.