APIs & Backend interview question

What is the difference between REST and GraphQL?

Short answer

REST exposes resources at URLs and uses HTTP methods and status codes, which makes caching and tooling straightforward. GraphQL exposes one endpoint with a typed schema where clients ask for exactly the fields they need, reducing over- and under-fetching. The trade-off is added server complexity: query cost control, N+1 resolution and less natural HTTP caching.

Choosing

  • REST — public APIs, simple CRUD, strong HTTP caching.
  • GraphQL — many clients with different data needs, aggregating several back-ends.
  • gRPC — internal service-to-service calls needing performance and strict contracts.

How to answer it in an interview

  • Mention DataLoader-style batching for the N+1 problem.
  • Talk about versioning: URL versions in REST, schema evolution in GraphQL.

Walk into your next interview prepared

Start free, install the Windows app and run a practice session today.