API styles

REST, GraphQL, gRPC and webhooks: what each does, when to choose it, and the rules that avoid duplicates, broken clients and inconsistent lists.

  • 33 cards
  • 3 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Scenarios
  3. Trade-offs and failures

A few cards from the deck

  • REST: what is it?

    Show the answer

    An API style where resources identified by URLs are handled with HTTP methods.

    Simple, widespread, and compatible with HTTP caching.

  • A mobile app must load profile, friends and notifications in one call, with only the displayed fields. Which style?

    • GraphQL
    • REST with three calls
    • A webhook
    • A message queue
    Show the answer

    GraphQL

    One query describes exactly what the screen needs.

  • GraphQL: what is it?

    Show the answer

    A query language where the client asks for exactly the fields it wants, through a single endpoint.

    The client avoids round trips and unneeded data.

  • What is a drawback of GraphQL?

    • HTTP caching is harder and overly costly queries must be limited
    • The client receives too much data
    • One endpoint per resource is needed
    • It only works internally
    Show the answer

    HTTP caching is harder and overly costly queries must be limited

    A client can write a huge query; safeguards are needed.