REST API vs GraphQL

Overview

Similarity

  • Both make http call from client to server and response in json format

Differences

Rest API

  • The data format and operation is defined by API route itself, each API end point have a clear definition

  • Easy to cache with CDN, proxies

  • Simple to make a call

GraphQL

  • The data format and operation is defined by client, The data definition is flexible

  • Hard to cache

  • Require time to learn, including query definition, tooling support to make call

Discussion

  • If data format is different from lots of application, there is time-wasting to develop various API end points to support different application, GraphQL is a better choice

  • Otherwise, In considering common practice, learning curve, the clearness of definition, REST API is a better choice for business

References

Last updated

Was this helpful?