Chapter 2. Selecting Your API Architecture
The happy towns are those that have an architecture.
Le Corbusier, Towards a New Architecture (Dover Publications, 1965)
In Chapter 1, you began your portfolio project by understanding user needs and selecting use cases to fulfill. That initial work is critical to make sure you build the right products to fulfill real customer needs. In this chapter, you will begin developing the architecture you will use to build your first APIs.
API Architectural Styles
One of the most significant decisions to make is selecting the API architectural style you will be using. Since you are using a consumer-centric design process, it follows that one of your first goals would be to use a style that is widely supported and understood by potential consumers. The Postman 2023 State of the API Report found these were the top six API architectural styles:
-
REST: 86%
-
Webhooks: 36%
-
GraphQL: 29%
-
Simple Object Access Protocol (SOAP): 26%
-
WebSockets: 25%
-
gRPC: 11%
The overwhelming popularity of REST found in the survey is consistent with what you will experience if you explore most public APIs. REST is currently the typical style used for APIs. For an example relevant to your project, all of the APIs that I have found for real-world fantasy football league hosts use REST.
There are a couple of other API architectural styles that are worth reviewing because they also make sense in data science and AI-related situations. Let’s take a closer look at ...
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