Chapter 2. API Design Patterns
This chapter is a practical guide for the design phase of the API lifecycle. It aims to raise awareness of common API topics such as API design patterns, API security patterns, and API best practices.
A software design pattern is a blueprint for solving a particular, commonly occurring problem when creating software. Designing an API is a multidimensional process, but certain challenges are common regardless of the API style. Design patterns can guide the development of solutions to these challenges.
This chapter presents these patterns individually, in a cookbook-like format, to help you select them and integrate them into your design process. To see how API design patterns are applied in practice, you’ll implement some of these patterns in Chapter 5 when building an example REST API.
Examples of API Design Patterns
No matter what API style you work with, you need to answer questions such as: what natural language to use for API documentation, how to version the API, how to name interfaces, what encoding to use, and how to serve data. This section explores the patterns commonly used to address these questions.
To study API design patterns further, we recommend API Design Patterns by JJ Geewax (Manning, 2021), or additional sources such as these:
-
The REST API Tutorial and Learn REST API Design overviews of REST APIs
Most of the time, you’ll develop APIs without access to their ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access