Table of Contents

Preface

Who Should Read This Book

About This Book

What’s Not in the Book

About the Author

I: Introduction to Web API Design

1. The Principles of API Design

The Elements of Web API Design

API Design Is Communication

Reviewing the Principles of Software Design

Resource-Based API Design

The Principles of Web API Design

Summary

2. Collaborative API Design

Why an API Design Process?

API Design Process Anti-Patterns

The API Design-First Approach

Remaining Agile with API Design-First

The Align-Define-Design-Refine Process

The Role of DDD in API Design

API Design Involves Everyone

Applying the Process Effectively

Summary

II: Aligning on API Outcomes

3. Identify Digital Capabilities

Ensuring Stakeholder Alignment

What are Digital Capabilities?

Focusing on the Jobs to be Done

What are Job Stories?

The Components of a Job Story

Writing Job Stories for APIs

Overcoming Job Story Challenges

Techniques for Capturing Job Stories

A Real-World API Design Project

Job Story Examples

Summary

4. Capture Activities and Steps

Extending Job Stories into Activities and Steps

Using EventStorming for Collaborative Understanding

How EventStorming Works

The Benefits of EventStorming

Facilitating an EventStorming Session

Summary

III: Defining Candidate APIs

5. Identifying API Boundaries

Avoiding API Boundary Anti-Patterns

Bounded Contexts, Subdomains, and APIs

Finding API Boundaries Using EventStorming

Finding API Boundaries Through Activities

Naming and Scoping APIs

Summary

6. API Modeling

What is API Modeling?

The API Modeling Process

Validating the API Model with Sequence Diagrams

Evaluating API Priority and Reuse

Summary

IV: Designing APIs

7. REST-Based API Design

What is a REST-based API?

REST API Design Process

Selecting a Representation Format

Common REST Design Patterns

Summary

8. RPC and Query-Based API Design

What is an RPC-based API?

RPC API Design Process

What is a Query-Based API?

Query-Based API Design Process

Summary

9. Async APIs for Eventing and Streaming

The Problem with API Polling

Async APIs Create New Possibilities

A Review of Messaging Fundamentals

Async API Styles

Designing Async APIs

Documenting Async APIs

Summary

V: Refining the API Design

10. From APIs to Microservices

What Are Microservices?

Microservices Reduce Coordination Costs

The Difference Between APIs and Microservices

Weighing the Complexity of Microservices

Synchronous and Asynchronous Microservices

Microservice Architecture Styles

Right-Sizing Microservices

Decomposing APIs Into Microservices

Considerations When Transitioning to Microservices

Summary

11. Improving the Developer Experience

Creating a Mock API Implementation

Providing Helper Libraries and SDKs

Offering CLIs for APIs

Summary

12. API Testing Strategies

Acceptance Testing

Automated Security Testing

Operational Monitoring

API Contract Testing

Selecting Tools to Accelerate Testing

The Challenges of API Testing

Make API Testing Essential

Summary

13. Document the API Design

The Importance of API Documentation

API Description Formats

Extending Docs with Code Examples

From Reference Docs to a Developer Portal

Effective API Documentation

The Minimum Viable Portal (MVP)

Tools and Frameworks for Developer Portals

Summary

14. Designing for Change

The Impact of Change on Existing APIs

API Versioning Strategies

Deprecating APIs

Establishing an API Stability Contract

Summary

15. Protecting APIs

The Potential for API Mischief

Essential API Protection Practices

Components of API Protection

API Gateway Topologies

Identity and Access Management (IAM)

Considerations Before Building an In-House API Gateway

Summary

16. Continuing the API Design Journey

Establishing an API Style Guide

Conducting API Design Reviews

Developing a Culture of Reuse

The Journey Has Only Begun

Appendix A. HTTP Primer

Overview of HTTP

The Uniform Resource Locator (URL)

HTTP Request

HTTP Response

Common HTTP Methods

HTTP Response Codes

Content Negotiation

Cache Control

Conditional Requests

Concurrency Control in HTTP

Summary