- Application Programming Interface (API) - a set of subroutine definitions, communication protocols, and tools for accessing backend servers
-
API Design Patterns (API-DP) - are Design Patterns that deals with designing APIs (these APIs usually use existing Network-Level APIs)
API Design Patterns
- consider using Description Language & Libraries (IDL)
- also see: Google API Design
|
Patterns |
Purpose |
Description |
|---|---|---|
|
CRUDing data |
| |
|
CRUDing data |
| |
|
brain fart |
| |
|
calling a procedure in another process and exchanging data |
| |
|
objected-oriented RPC |
| |
|
streaming data |
| |
|
subscribers & providers |
an API design pattern for subscribers and providers Client/Subscriber
Server/Provider has 2 tasks:
| |
|
subscribers & providers |
an API design pattern for subscribers and providers WebSub is built upon an ecosystem of:
Compared to WebHook, WebSub requires way less effort for Publishers as all they need to do is declare the Hub they’re using with the Link Header, and then ping it when they have new content published. For Client/Subscribers, not much changed as they’re still going to make a subscription request but this time to the Hub, which is going to ping them at its turn when new content has been published. |
API Design Pattern Comparisons
- REST vs GraphQL
- Caching - you can’t “network” cache GraphQL results as easily as you can with REST results. GraphQL relies on “application” caching, which is a little more complicated
- RPC vs REST - over HTTP
- If an API is mostly actions, maybe it should be RPC
- If an API is mostly CRUD, maybe it should be REST
- RPC vs REST vs GraphQL - over HTTP
- SOAP vs REST
- WebHooks vs WebSubs