This book looks at the most popular API styles from a network, application, and architecture perspective. You'll learn how to determine the appropriate type of API for your application use case and how to tackle design decisions along the way. You'll also learn the trade-offs between various APIs and acquire practical knowledge of how to implement them.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
# Learning API Styles — Reading Guide
## 【One-Line Pitch】
A practical, hands-on guide for developers and architects who want to understand the trade-offs between major API styles—REST, GraphQL, gRPC, webhooks, WebSocket, and message brokers—and learn how to choose and implement the right one for their use case. If you're building network-based APIs and want to move beyond "REST is the default," this book gives you the conceptual framework and working code examples to make informed decisions.
## 【Book Arc】
- **Opening (~0%–10%)**: Defines what network-based APIs are, distinguishes synchronous vs. asynchronous communication, and introduces functional vs. nonfunctional requirements as the lens for evaluating API styles. Sets up the book's scope: six API styles covered in dedicated chapters, with a deliberate focus on the role of network protocols—an often-overlooked aspect.
- **Early (~10%–23%)**: Covers API design fundamentals that apply across all styles: versioning strategies (with deprecation and retirement dates), resource-oriented vs. intent-oriented API design (declarative vs. imperative), filtering approaches, request retry patterns (including thundering herd and retry storm problems), and security basics like sanitization, validation, and least privilege.
- **Early (~23%–32%)**: Dives into the network layer—DNS, TCP, and TLS—with hands-on labs using Python Socket API and Docker containers. You'll implement a TCP ECHO service three ways (command-line tool, low-level Python, high-level socket API) and observe TLS handshakes in packet captures. This groundwork explains *why* protocols behave as they do.
- **Middle (~32%–42%)**: Traces HTTP evolution from HTTP/0.9 through modern versions, including HTTP/3 over QUIC. You'll examine real packet captures, understand headers like ETag and Keep-Alive, and learn about head-of-line blocking and the deployment realities of HTTP/3 (middlebox compatibility, cloud platform support).
- **Middle (~42%–48%+)**: Begins the API-style chapters with REST—URI anatomy, stateless interaction, resource organization (including when to avoid nesting endpoints), and versioning in practice. Includes working examples with Docker, curl, and JSON payloads.
## 【Key Takeaways】
- **Functional vs. nonfunctional requirements are the right lens for API selection** (Early): FRs describe what the system does; NFRs describe quality attributes ("ilities" like deployability, scalability). Classifying requirements this way helps prioritize design efforts and communicate risks before committing to an API style.
- **Resource-oriented APIs are declarative; intent-oriented APIs are imperative** (Early): REST uses standard HTTP verbs to abstract implementation details (declarative), while gRPC names actions explicitly (imperative). GraphQL mixes both—declarative queries with imperative mutations. This distinction clarifies why different styles feel different to use.
- **API versioning requires explicit deprecation and retirement dates** (Early): Notify users through multiple channels—CLI warnings (Kubernetes), documentation banners (Google PaLM API), or HTTP headers like `Deprecation` and `Sunset`. A versioning strategy without a retirement plan leaves users stranded.
- **Retry logic needs protection against retry storms** (Early): Blind retries can prolong outages (thundering herd problem). Use maximum retry cutoffs with expiration timers, or a circuit-breaker pattern that tracks success/failure ratios. Knowing *when not to retry* is as important as knowing when to.
- **Never trust input data—sanitize and validate everything** (Early): Sanitization removes unwanted input (unexpected characters, whitespace); validation enforces constraints (ranges, formats). Without both, injection attacks and data breaches become possible. Apply least privilege to API clients.
- **Network protocols shape API behavior more than most API books acknowledge** (Early–Middle): DNS maps names to IPs, TCP provides reliable in-order delivery (but with head-of-line blocking), TLS adds handshake overhead. Understanding these layers explains why HTTP/3 over QUIC exists and why it isn't universally deployed yet.
- **HTTP/3's real advantage may be as a QUIC deployment vehicle** (Middle): While HTTP/3 offers header compression and reduced connection latency, it faces adoption barriers—middleboxes that block UDP, cloud platforms requiring proxies, and TLS 1.3 compatibility issues. Its broader impact may be enabling new protocols (SMB over QUIC, WebTransport).
## 【Reading Tips】
- **Skim the early requirement-classification sections** (~10%) if you're already familiar with FR/NFR thinking; the real value starts with the design patterns (versioning, filtering, retries) around ~13–23%.
- **Deep-read the network chapters** (~23–32%) even if you're not a network engineer—the TCP ECHO lab and TLS handshake walkthroughs make abstract protocol concepts concrete. The Docker-based labs are worth running hands-on.
- **The HTTP evolution chapter** (~32–42%) is best read as context, not reference—you don't need to memorize HTTP/0.9 details, but understanding *why* headers and status codes exist helps when designing REST APIs later.
- **Watch for the recurring trade-off framework**: each API style chapter (REST, GraphQL, gRPC, webhooks, WebSocket, RabbitMQ) evaluates the style against network, application, and architecture perspectives. Use this framework to compare styles for your own projects.
- **The REST chapter** (~42–48%+) includes practical examples with Docker, curl, and JSON—follow along if you want implementation experience, but the design guidance (resource organization, versioning) is valuable even without running the code.
## 【Coverage Limits】
This guide covers the book's opening through the early REST chapter (~48%). The excerpts do not cover the GraphQL, gRPC, webhooks, WebSocket, or RabbitMQ chapters in detail, nor the book's exercises and setup instructions beyond what appears in the sampled sections.
##
Excerpt 1
hat communicate over a computer network. Typical interfaces in this category are web APIs, which are served by the web server and consumed by the web browser...
the tables follows CRUD (Create, Read, Update, and Delete). See “CRUD” for more information. NOTE It’s possible to combine various API versioning strategies....
tate persistence, that state is maintained on the client. 3. Cacheable resources—Responses should explicitly indicate whether they are cacheable. Caching imp...
ce. The Enrich() unary RPC method accepts a WeatherForecast custom message type as the request, and responds with a content string containing the summary of...
As the name indicates, only client’s requests that contain the host header value included in the server’s trusted hosts list are accepted by the server. By r...
er The listeners settings specify application ports for unencrypted (5672) and encrypted (5671) communication. The block describes the broker’s TLS configura...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Learning API Styles (for Raymond Rhine) (Lukasz Dynowski, Marcin Dulak)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share to WeChat Moments
Learning API Styles (for Raymond Rhine) (Lukasz Dynowski, Marcin Dulak)(Z-Library)
Scan the QR code with WeChat to open this book
Tap the ··· menu in the top-right corner
Choose Share to Moments
You are already in WeChat. Tap ··· in the top-right corner and choose Share to Moments.
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Learning API Styles (for Raymond Rhine) (Lukasz Dynowski, Marcin Dulak)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
这本书从网络、应用和架构三个层面审视当下最流行的几种 API 风格,核心目的在于帮助读者判断什么样的 API 类型适合自己的应用场景,并在设计过程中做出合理的取舍。它并不局限于罗列概念,而是把选型当作一个需要权衡的决策过程:不同风格各有代价,理解这些代价才能选出真正贴合需求的那一种。
读者可以顺着几条线索把握全书脉络。其一是选型思路,书中反复强调要先弄清应用的实际用例,再据此确定合适的 API 类型,而不是先入为主地认定某一种风格。其二是设计决策,作者把设计过程中会遇到的具体问题摆出来讨论,比如在序列化格式不支持枚举时如何用字符串表示枚举值——这种做法需要应用端额外实现相应逻辑,属于典型的取舍。其三是实现层面的实践知识,书中涉及的内容相当具体,包括抓取网络数据包来观察传输行为、用递归查询演示 GraphQL 的能力并说明如何防止递归带来的风险、借助抓包工具查看 RPC 调用中 protobuf 消息的二进制格式,以及消息代理在未加密与加密端口上的监听设置和 TLS 配置。其四是安全与通信细节,例如共享密钥在服务之间的使用、回调地址的注册等,都提示 API 设计不能脱离网络与部署环境来谈。
整体而言...
Digital LibraryAI Assistant
Hi — I can help you pick a book. Tell me a topic, language, or level, e.g. “a light English read”. If that's too broad, I'll ask one follow-up.
Loading comments...
Reply to Comment
Edit Comment