INITIALIZING SECURE CHANNEL...
CPU MEM NET PING9.2 ms SECSECURED
COFFEE—WEB v4.0 // eu-1
ONLINE 2 847 --:--:--
/english > 33. API Design Discussions
// УРОК 33

API Design Discussions

B2

API Design Discussions

Design Principles

  • versioning: "We version the API via URL: /api/v1/ and /api/v2/"
  • pagination: "We use cursor-based pagination for large datasets."
  • idempotency keyPrevents duplicate operations on retry
  • backward compatibility: "We never remove fields — we deprecate them."

REST vs GraphQL

RESTGraphQL
Data fetchingMultiple endpointsSingle endpoint, flexible queries
Over-fetchingCommonEliminated — clients request only what they need
VersioningURL-based (/v1, /v2)Schema evolution
Best forSimple CRUD, public APIsComplex UIs with varied data needs

Useful Phrases

  • "GraphQL eliminates over-fetching — the client requests exactly the fields it needs."
  • "We use cursor-based pagination instead of offset pagination for consistent results at scale."
  • "Adding an idempotency key ensures retrying a failed payment does not charge the user twice."
// TERMINAL CHALLENGE

Проверь себя

Q1. What is the main advantage of GraphQL over REST for complex UIs?
Q2. What is an 'idempotency key' used for?
Q3. What is 'cursor-based pagination' and why is it preferred at scale?
Q4. Complete: 'We never ___ fields — we deprecate them first and remove them in the next major version.'
Q5. What does 'backward compatibility' mean for an API?
╔═ GL1TCH v0.1 ═[ПОДКЛЮЧЕНО]═╗ [×]
СОЕДИНЕНИЕ АКТИВНО
запросов:
// сессия #{} начата
>_
[ РАЗРЫВ СВЯЗИ ]
лимит исчерпан...
иду спать... zzZ
хочешь больше? [зарегистрироваться] // +10 запросов в день