SlideShare a Scribd company logo
API DESIGN
5 Anti-Patterns
in
Ali
@aliostadKheyrollahi
W iiiiiiire Wiie
5 Anti-PatternsWho Are WeASOS
ASOS is a global fashion
destination for 20-somethings.
From fashion advice, stories
and inspiration, to more than
80,000 products available to
buy on any device, ASOS, with
its unbeatable service, is a true
home for fashion lovers.
5 Anti-PatternsIn NumbersASOS
~1 bln Turnover (ÂŁ)
1.1 bln visits / year
9.9 mln Active customers
58% International
3.7 M
3.3 M
2.4 M
885 K
API The Art of Presentation
API, API . . .
. . . everywhere
API Iceberg
“This huge mass underneath the water that you can't see,
the private API, is the biggest part of the whole
opportunity.”
Daniel Jacobson, Netflix - 2011
@aliostad
Micro services
“ … the microservice architectural style is an
approach to developing a single application as a
suite of small services, each running in its own
process and communicating with lightweight
mechanisms, often an HTTP resource API”
Martin Fowler - Bliki
REST Stateless
REST Layered Architecture
REST Caching
@aliostad
Resources and
representations
REST Uniform Interface
S e l f - d e s c r i p t i v e
messages
Hypermedia
@aliostad
REST Client-Server
@aliostad
HTTP Client-Server
GET /api/catalogue/products/123456
GET /api/catalogue/Products/123456
S e r v e r C o n c e r n
@aliostad
HTTP Client-Server
GET /api/catalogue/Products/123456
301 Moved Permanently
Location /api/catalogue/products/123456
C l i e n t C o n c e r n
GET /api/catalogue/Products/123456
???
1
2
@aliostad
HTTP Client-Server
M i x e d C o n c e r n
GET /api/catalogue/Products/123456
200 OK
max-age: 300
GET /api/catalogue/Products/123456
If-Modified-Since: Fri, 15 Jan 2016 10:28:16 GMT
304 Not Modified
@aliostad
Client-Server Boundary
Boundary
@aliostad
CSDS Client-Server Domain Separation
“ Client and server must
dene and live within their
own bounded context ”
CSDS Client-Server Domain Separation
S e r v e r
API Restaurant
5 Anti-Patterns in Api Design - NDC London 2016
@aliostad
CSDS Client-Server Domain Separation
C l i e n t
Can be a server itself1
2 Uses services of server(s) to bring value to end-user (directly or indirectly)
3 Free to take dependency on Server’s public domain (Resource Comprehension)
Normally keeps state but does not master it4
@aliostad
Client-Server Boundary
Boundary
5 Anti-Patterns in Api Design - NDC London 2016
Anti-Pattern Transparent Server
1
“server exposes its
internal implementation
to its clients”
Anti-Pattern Transparent Server
server's private domain or the domain of its
underlying dependencies bleeds into its
public API
@aliostad
E x a m p l e 1
Anti-Pattern Transparent Server
E x a m p l e 2
Always for a customer1
2 Only for customers currently shopping
3 Get expired after inactivity
A couple of tables or
a document database
4 Max one basket per customer
Anti-Pattern Transparent Server
@aliostad
E x a m p l e 2
POST /baskets?cid=908
201 Created
Location: /baskets/123435455456
POST /baskets/123435455456{...}
200 OK
x
Anti-Pattern Transparent Server
@aliostad
E x a m p l e 2
POST customer/me/basket
{…}
200 OK
✓
Anti-Pattern Transparent Server
Anti-Pattern Chauvinist Server
2
“designing the API from
server's perspective”
Anti-Pattern Chauvinist Server
Server pushes its thinking and process
to the client
resulting in the client becoming
a subordinate
@aliostad
Anti-Pattern Chauvinist Server
H A T E O A S(and not hypermedia itself)
Hypermedia
as the Engine
of Application (state)
Anti-Pattern Chauvinist Server
H A T E O A S
Client most likely a server [wasteful to navigate]2
3 Client uses more than one server
6 Microservices: servers smaller, containing a couple of resources
4 Undened caching directives for hypermedia
Server hasn’t got a clue what the application is1
5 Don’t try to spare the client composing URLs
Anti-Pattern Chauvinist Server
H A T E O A S?
R e a l l y ? ?
Anti-Pattern Demanding Client
3
“client enforces its special
needs onto the API
signature”
Anti-Pattern Demanding Client
certain clients limitations (or reluctance to
implement) become server's default behaviour
@aliostad
Anti-Pattern Demanding Client
GET /api/catalogue/products.xml
GET /api/catalogue/products.json
GET /api/catalogue/products?format=xml
GET /api/catalogue/products?format=json
x
E x a m p l e 1
Bioenergy KDF
REST API
@aliostad
Anti-Pattern Demanding Client
GET /api/catalogue/products
Accept: application/json
E x a m p l e 1
✓
@aliostad
Anti-Pattern Demanding Client
E x a m p l e 2
GET /api/catalogue/products?client=mobile
GET /api/catalogue/products?model=summary
x
@aliostad
Anti-Pattern Demanding Client
E x a m p l e 2
✓GET /api/catalogue/products?fields=foo,bar,jazz
GET /api/catalogue/products_summary
Anti-Pattern Assuming Server
4
“server assumes the role of
defining client experience”
Anti-Pattern Assuming Server
server makes decisions on issues that are
inherently client concerns
@aliostad
E x a m p l e 1
Anti-Pattern Assuming Server
GET /api/catalogue/products/pages/1
GET /api/catalogue/products/pages/2
x
E x a m p l e 1
Anti-Pattern Assuming Server
GET /api/catalogue/products?from=1&count=30
✓
GET /api/catalogue/products?offset=1&limit=30
E x a m p l e 2
Anti-Pattern Assuming Server
B r o w s e r
s n i f f i n g
Anti-Pattern Presumptuous Client
5
“client takes on responsibilities
that cannot fulfil”
Anti-Pattern Presumptuous Client
Client presumes it can full some
responsibilities that are inherently server’s
E x a m p l e s
Anti-Pattern Presumptuous Client
A P I
Identity
E x a m p l e s
Anti-Pattern Presumptuous Client
I D S E R V E R
Long Expiry Token
ID Request
A P I
Token
E x a m p l e s
Anti-Pattern Presumptuous Client
I D S E R V E R
ID Token
ID Request
A P I
Access TokenAccess Token
. . .
ID Token
✓
@aliostad
E x a m p l e s
Client act as an authority for authentication or authorisation1
2 Client implements an algorithm that needs to be centralised on server
3 Client takes control of cache invalidation
Anti-Pattern Presumptuous Client
@aliostad
Microservices take importance of APIs to a new level1
2 Think of your API as a restaurant and remember the contrast with kitchen
3 Transparent Server: Exposing internals
Re Cap
4 Chauvinist Server: Client becoming a subordinate
5 Demanding Client: Client enforcing special needs to API signature
6 Assuming Server: Server deciding client experience
7 Presumptuous Client: Client taking responsibilities cannot full
Thank You
@aliostad
http://byterot.blogspot.com

More Related Content

PDF
5 must-have patterns for your microservice - buildstuff
PDF
5 must have patterns for your microservice
PDF
5 Anti-Patterns in Api Design - buildstuff
PDF
5 Anti-Patterns in API Design - DDD East Anglia 2015
PDF
Microservice architecture at ASOS
PDF
5 Anti-Patterns in API Design
PPTX
The Mushroom Cloud Effect - What happens when containers fail?
PPTX
Running microservice environments is no free lunch
5 must-have patterns for your microservice - buildstuff
5 must have patterns for your microservice
5 Anti-Patterns in Api Design - buildstuff
5 Anti-Patterns in API Design - DDD East Anglia 2015
Microservice architecture at ASOS
5 Anti-Patterns in API Design
The Mushroom Cloud Effect - What happens when containers fail?
Running microservice environments is no free lunch

Viewers also liked (7)

PDF
Topic Modelling and APIs
PDF
Some REST Design Patterns (and Anti-Patterns) - SOA Symposium 2009
PDF
บริการต่างๆบนอินเทอร์เน็ต1
DOCX
ความหมายและความสำคัญของโครงงาน
 
PDF
3c3 nonhomgen lineqns-stuhuhuhuhuhh
PDF
Us Elections 2016 - Iran Elections 2005
PPTX
DDD_Pitch Deck_Jan 2017
Topic Modelling and APIs
Some REST Design Patterns (and Anti-Patterns) - SOA Symposium 2009
บริการต่างๆบนอินเทอร์เน็ต1
ความหมายและความสำคัญของโครงงาน
 
3c3 nonhomgen lineqns-stuhuhuhuhuhh
Us Elections 2016 - Iran Elections 2005
DDD_Pitch Deck_Jan 2017
Ad

Similar to 5 Anti-Patterns in Api Design - NDC London 2016 (20)

PDF
Resilient Event Driven Systems With Kafka
PDF
Lessons from running AppSync in prod
PDF
HTML Hypermedia APIs and Adaptive Web Design - jDays 2013
PDF
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
PPTX
Cassandra in xPatterns
PDF
Eventos y Microservicios - Santander TechTalk
PDF
Speed Wins: From Kafka to APIs in Minutes
PPTX
Everybody loves Swagger
PDF
Microservices Practitioner Summit Jan '15 - Don't Build a Distributed Monolit...
PDF
RefCard API Architecture Strategy
PDF
Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...
PDF
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...
PDF
What’s the big deal with Graph Databases?
PPTX
Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
PDF
MongoDB & Chirp
PPTX
5 Years Of Building SaaS On AWS
PDF
Single Source of Truth for Network Automation
PDF
Log Analytics with AWS
PDF
Making the Most of Customer Data
 
PPTX
Everybody loves Swagger (Massimo Crippa @ Integration Monday)
 
Resilient Event Driven Systems With Kafka
Lessons from running AppSync in prod
HTML Hypermedia APIs and Adaptive Web Design - jDays 2013
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Cassandra in xPatterns
Eventos y Microservicios - Santander TechTalk
Speed Wins: From Kafka to APIs in Minutes
Everybody loves Swagger
Microservices Practitioner Summit Jan '15 - Don't Build a Distributed Monolit...
RefCard API Architecture Strategy
Streamsheets and Apache Kafka – Interactively build real-time Dashboards and ...
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...
What’s the big deal with Graph Databases?
Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
MongoDB & Chirp
5 Years Of Building SaaS On AWS
Single Source of Truth for Network Automation
Log Analytics with AWS
Making the Most of Customer Data
 
Everybody loves Swagger (Massimo Crippa @ Integration Monday)
 
Ad

More from Ali Kheyrollahi (11)

PDF
Autonomous agents with deep reinforcement learning - Oredev 2018
PDF
Buildstuff - what do you need to know about RPC comeback
PDF
Deep learning for developers - oredev
PDF
Microservice Architecture at ASOS - DevSum 2017
PDF
5 must have patterns for your microservice - techorama
PDF
Real time monitoring-alerting: storing 2Tb of logs a day in Elasticsearch
PDF
From Power Chord to the Power of Models - Oredev
PDF
From Hard Science to Baseless Opinions - Oredev
PDF
From hard science to baseless opinions
PDF
From power chords to the power of models
PDF
Http caching 101 and a bit of CacheCow
Autonomous agents with deep reinforcement learning - Oredev 2018
Buildstuff - what do you need to know about RPC comeback
Deep learning for developers - oredev
Microservice Architecture at ASOS - DevSum 2017
5 must have patterns for your microservice - techorama
Real time monitoring-alerting: storing 2Tb of logs a day in Elasticsearch
From Power Chord to the Power of Models - Oredev
From Hard Science to Baseless Opinions - Oredev
From hard science to baseless opinions
From power chords to the power of models
Http caching 101 and a bit of CacheCow

Recently uploaded (20)

PDF
Cost to Outsource Software Development in 2025
PPTX
Introduction to Windows Operating System
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
 
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PPTX
Cybersecurity: Protecting the Digital World
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
Trending Python Topics for Data Visualization in 2025
PDF
Website Design Services for Small Businesses.pdf
PDF
Complete Guide to Website Development in Malaysia for SMEs
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
Cost to Outsource Software Development in 2025
Introduction to Windows Operating System
MCP Security Tutorial - Beginner to Advanced
Digital Systems & Binary Numbers (comprehensive )
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Computer Software and OS of computer science of grade 11.pptx
Why Generative AI is the Future of Content, Code & Creativity?
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
 
Wondershare Recoverit Full Crack New Version (Latest 2025)
How to Use SharePoint as an ISO-Compliant Document Management System
Cybersecurity: Protecting the Digital World
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Designing Intelligence for the Shop Floor.pdf
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Trending Python Topics for Data Visualization in 2025
Website Design Services for Small Businesses.pdf
Complete Guide to Website Development in Malaysia for SMEs
Topaz Photo AI Crack New Download (Latest 2025)
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)

5 Anti-Patterns in Api Design - NDC London 2016