01
API Styles
Different interface styles that meet the same need: the notion of a contract and of compatibility, a comparison of resource-based, remote procedure call, and query-based approaches measured by request count and bytes transferred, REST principles, binary protocols, and communication outside the request-response pattern.
- 01 What Is an API What makes an interface a contract: the consumer's unwritten assumptions, defining compatible and breaking change by consumer behavior, the different response a tolerant reader and a strict reader give to the same change, and who owns the contract.
- 02 Comparison of API Styles Three styles that meet the same job: resource-based, remote-procedure-call style, and query-based approaches are written for the same scenario and compared by measuring request count, bytes on the wire, and the used share of carried fields; the lesson shows which side has to change when the requirement changes.
- 03 REST Principles The set of constraints behind the resource-based style: demonstrating statelessness by testing the same request in two separate processes, measuring the uniform interface with a client that does not know the resource name, the effect of cacheability with an entity tag on bytes carried, and how a layered system follows from these constraints.
- 04 Remote Procedure Call and gRPC The approach that writes the contract first: a validator generated from a schema file, the field number being the wire's identity, a byte comparison between a custom binary framing and the text format, and how gRPC brings this design together with stream types.
- 05 GraphQL Client-driven query over a single endpoint: the type system the server publishes, validating the query against the schema before it runs, per-field resolution, and the partial success response that results when one field errors; reusing the same document with variables.
- 06 Legacy Protocols The design and legacy of envelope-based protocols: separating header from body, carrying the operation name inside the envelope, reporting errors in the envelope instead of the transport layer, how the envelope's cost changes with record count, and which of today's interface decisions were inherited from here.
- 07 Synchronous and Asynchronous APIs Communication forms outside the request–response pattern: event stream, long polling, and short polling are compared on the same event sequence by connection count, bytes carried, and delivery delay; a long-running job is modeled with an accepted request and a separate status resource.