historY

RPC / WEB API's

CORBA / DCOM

XML-RPC

SOAP

REST

inherent complexity

verbose, xsd schemas,

http, overhead

crud, http verbs, <json />

Which is better?

... it depends! 😎

REST

  • Client-Server
  • XML / JSON
  • Resource-oriented
  • Stateless
  • HTTP uniformity (verbs & conventions)
  • Hypermedia (links & relationships)

representational state transfer

ful

ish

GraphQL

DECLARATIVE API query language

Ask for what you need, get exactly that

DECLARATIVE API query language

Mutate (create, update, delete) your data

Schema type system

GraphQL APIs are organized in terms of types and fields, not endpoints

DATABASE AGNOSTIC

Use any persistence layer and define your own data resolvers

developer experience & tools

GraphQL

R.I.P. REST?

🙈

REST

  • Multiple requests
  • Any HTTP Client + Docs
  • Format? Included relationships / links?
  • Filter / Sort by query params
  • Easy pagination

GRAPHQL

  • Single request
  • Built-in tools (GraphiQL)
  • Free-form JSON representation
  • Declarative queries / mutations
  • Good luck!
good ol'
new kid on the block

🤜🤛

-ish

GraphQL Puts Client Performance First

GraphQL is always the 
smallest possible request,
whilst REST generally defaults
to the fullest.

REST Makes Caching Easier At All Levels

The URL in [REST] APIs is a globally unique identifier that the client can leverage to build a cache
In GraphQL, though, there's no URL-like primitive... you need an API implementation to expose such an identifier  

Which is better?

... They kinda complement each other! 😎2017😎

(YOU CAN) USE BOTH!

(if you benefit from each)

Made with Slides.com