SlideShare a Scribd company logo
Designing APIs
Damir Svrtan
Less Data is More
Damir Svrtan
He/him
Senior Software Engineer @ Netflix
Twitter: @DamirSvrtan
San Francisco 🇺🇸
Zagreb 🇭🇷
Designing APIs
Less Data is More
Avoiding overhead when
designing APIs
Bloated overly flexible APIs
What kind of APIs?
• HTTP based APIs
• REST APIs, JSON APIs, GraphQL etc
API technology agnostic
Applicable for all kinds of APIs
Blogging Platform
Blogging Platform:
• Authors can release posts
• Posts can have comments
Two principles for
building APIs
• Designing the minimal API surface
• Designing from Strict to Loose
1st Principal
Design the minimal API surface
Bloated API surface:
- redundant fields
- redundant relationships
- redundant input fields
Don’t Expose Redundant
Fields
Requirement:
“Show the author of the blogpost”
CREATE TABLE authors (
id
first_name
last_name
email
avatar_url
);
apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svrtan, Netflix
Friendly API developer:
“Let’s expose the email, someone might find it
useful in the future”
type Author {
id
firstName
lastName
avatarUrl
email
}
6 months later:
Privacy reasons: stop exposing the email
..deprecation cycle..
..extreme amounts of communication..
..breaking clients..
..extreme amounts redundant cycles..
Don’t Expose Redundant
Relationships
Requirement:
“Indicate whether a post was reviewed”
type Post {
title:String
body:String
}
type Post {
title:String
body:String
reviewed:Boolean
}
Friendly API developer:
“Let’s expose the reviewer for future use
cases”
type Post {
title:String
text:String
reviewed:Boolean
reviewer: Reviewer
}
Development costs are growing;
- batch/eager loading
- testing
- performance impacts
type Post {
title:String
text:String
reviewed:Boolean
reviewers: [Reviewer]
}
type Post {
title:String
text:String
reviewed:Boolean
reviewer: Reviewer
}
..deprecation cycle..
..breaking clients..
Delaying Decisions
Adding later when we have more knowledge is better
It’s easier to add in the future than to remove
Don’t Expose Redundant
Input Fields
Requirement:
“Readers need to be able to create and
update comments”
input CreateComment {
postId: ID
body: String
}
The friendly API developer:
“Let’s have parity between inputs”
input UpdateComment {
id: ID
postId: ID
body: String
}
The blogging platform doesn’t support
comment transitions from one post to another
input UpdateComment {
id: ID
postId: ID
body: String
}
Avoid anemic data modeling
apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svrtan, Netflix
Ambiguity deteriorates
Developer Experience
You Ain’t Gonna Need It
2nd Principal
Strict to Loose
- Avoid extra flexibility
- Breaks First!
Avoid extra flexibility
Requirement:
“The users need to be able to see comments
on a post”
comments(postId: ID @required)
The friendly API developer:
“Our clients might want to fetch all comments
in the future”
comments(postId: ID @optional)
Unneeded application logic
If postId.present?
…
else
…
end
More code = More maintenance
More code = More tests
On inputs, it’s easy to go from required to
optional, not the other way around
Strict to Loose gives you more
control
Loose to Strict
is a breaking change
Breaks First!
Requirement:
“Ability to fetch comments for a post”
The friendly API developer:
“Let’s just give them an array of comments,
we don’t need pagination!”
The friendly API developer:
“Let’s just give them an array of comments,
we don’t need pagination yet!”
comments(postId: ID): [Comment]
The friendly API developer:
“We won’t have more than 5 comments per
post!”
6 months after:
“There’s posts with 100’s of comments”
Developer:
“Let’s add pagination”
comments(postId: ID): PaginatedComments
Work is done, let’s go home!
comments(postId: 1, first: 1000)
The Friendly API Developer didn’t
add limits to pagination
Add pagination limitations from the beginning
Error Message:
Requesting 1000 records exceeds the `first`
limit of 100 records.
Super hard to add retroactively, but super
easy to adjust in the future.
How to avoid these overheads?
Adopt Schema First Design
Talk to your clients
Be responsive to your clients
requests
There’s always exceptions
Platform APIs
Constraints due to release cycles
Conclusion
Redundant work slows down
progress on important features
“The road to hell is paved with good
intentions”
Thank you! 👋
Twitter: @DamirSvrtan

More Related Content

PDF
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
PDF
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
PDF
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
PPTX
Open Event API
PDF
apidays LIVE Hong Kong 2021 - Better API DX with a CLI by Phil Nash, Twilio
PDF
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
PDF
apidays LIVE Australia 2021 - Designing APIs: Just Enough is Perfect! by Dami...
PDF
apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...
apidays LIVE Hong Kong 2021 - Less Data is More by Damir Svrtan, Netflix
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
Open Event API
apidays LIVE Hong Kong 2021 - Better API DX with a CLI by Phil Nash, Twilio
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
apidays LIVE Australia 2021 - Designing APIs: Just Enough is Perfect! by Dami...
apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...

What's hot (20)

PPTX
API-first development
PDF
Essential Ingredients for a Successful API Program
PDF
apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...
PDF
apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...
PDF
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
PPTX
Tools and techniques for APIs
PPTX
Pain Points In API Development? They’re Everywhere
PPTX
Past, Present, Future of APIS
PDF
Tools for designing and building great APIs
PDF
apidays LIVE LONDON - OpenAPI-driven API development lifecycle at Adyen by Al...
PPTX
Scaling API Design
PPTX
Design and Evolution of APIs in Microservice Architecture
PDF
apidays LIVE Australia 2020 - Federating API Development at Australia’s large...
PPTX
Building APIs with Node.js and Swagger
PDF
[API World 2021 ] - Understanding Cloud Native Deployment
PDF
apidays LIVE Paris 2021 - Learning the Language of HTTP for a Better Data Exp...
PDF
INTERFACE, by apidays - API Design is where culture and tech meet each other...
PPTX
apidays LIVE LONDON - Discovering API Version differences with ease by Jaap B...
PDF
Designing APIs with OpenAPI Spec
PDF
Beyond the basic Swagger UI: Adyen API Explorer
API-first development
Essential Ingredients for a Successful API Program
apidays LIVE London 2021 - API Horror Stories from an Unnamed Coworking Compa...
apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
Tools and techniques for APIs
Pain Points In API Development? They’re Everywhere
Past, Present, Future of APIS
Tools for designing and building great APIs
apidays LIVE LONDON - OpenAPI-driven API development lifecycle at Adyen by Al...
Scaling API Design
Design and Evolution of APIs in Microservice Architecture
apidays LIVE Australia 2020 - Federating API Development at Australia’s large...
Building APIs with Node.js and Swagger
[API World 2021 ] - Understanding Cloud Native Deployment
apidays LIVE Paris 2021 - Learning the Language of HTTP for a Better Data Exp...
INTERFACE, by apidays - API Design is where culture and tech meet each other...
apidays LIVE LONDON - Discovering API Version differences with ease by Jaap B...
Designing APIs with OpenAPI Spec
Beyond the basic Swagger UI: Adyen API Explorer
Ad

Similar to apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svrtan, Netflix (20)

PDF
Mobile API: Design & Techniques
PDF
JOSA TechTalks - RESTful API Concepts and Best Practices
PDF
APIs are for People Too
PPTX
API and DB design with Boolean
PDF
Consumer centric api design v0.4.0
PDF
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
PDF
How to Design a Good API and Why it Matters.pdf
PDF
GraphQL: APIs the New Way.
PPTX
Intro to API Design Principles
PDF
Why your APIs should fly first class
PDF
GraphQL - APIs The New Way
PPTX
Practices and Tools for Building Better APIs
PPTX
Considerations For an API Strategy - Ronnie MItra API Architect Layer 7 Londo...
PPTX
Building a REST API for Longevity
PDF
GraphQL APIs in Scala with Sangria
PDF
MongoDB and Schema Design
PPTX
CakeFest 2013 - A-Z REST APIs
PPTX
CakeFest 2013 - A-Z REST APIs
PDF
Data to Go: Mobile API Design
PDF
INTERFACE, by apidays - Scaling APIs
Mobile API: Design & Techniques
JOSA TechTalks - RESTful API Concepts and Best Practices
APIs are for People Too
API and DB design with Boolean
Consumer centric api design v0.4.0
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
How to Design a Good API and Why it Matters.pdf
GraphQL: APIs the New Way.
Intro to API Design Principles
Why your APIs should fly first class
GraphQL - APIs The New Way
Practices and Tools for Building Better APIs
Considerations For an API Strategy - Ronnie MItra API Architect Layer 7 Londo...
Building a REST API for Longevity
GraphQL APIs in Scala with Sangria
MongoDB and Schema Design
CakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIs
Data to Go: Mobile API Design
INTERFACE, by apidays - Scaling APIs
Ad

More from apidays (20)

PDF
apidays Munich 2025 - The Physics of Requirement Sciences Through Application...
PDF
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
PDF
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
PDF
apidays Munich 2025 - Integrate Your APIs into the New AI Marketplace, Senthi...
PDF
apidays Munich 2025 - The Double Life of the API Product Manager, Emmanuel Pa...
PDF
apidays Munich 2025 - Let’s build, debug and test a magic MCP server in Postm...
PDF
apidays Munich 2025 - The life-changing magic of great API docs, Jens Fischer...
PDF
apidays Munich 2025 - Automating Operations Without Reinventing the Wheel, Ma...
PDF
apidays Munich 2025 - Geospatial Artificial Intelligence (GeoAI) with OGC API...
PPTX
apidays Munich 2025 - GraphQL 101: I won't REST, until you GraphQL, Surbhi Si...
PPTX
apidays Munich 2025 - Effectively incorporating API Security into the overall...
PPTX
apidays Munich 2025 - Federated API Management and Governance, Vince Baker (D...
PPTX
apidays Munich 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (Aavista Oy)
PPTX
apidays Munich 2025 - Streamline & Secure LLM Traffic with APISIX AI Gateway ...
PPTX
apidays Munich 2025 - Building Telco-Aware Apps with Open Gateway APIs, Subhr...
PPTX
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
PDF
apidays Helsinki & North 2025 - REST in Peace? Hunting the Dominant Design fo...
PDF
apidays Helsinki & North 2025 - Monetizing AI APIs: The New API Economy, Alla...
PDF
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
PDF
apidays Helsinki & North 2025 - APIs in the healthcare sector: hospitals inte...
apidays Munich 2025 - The Physics of Requirement Sciences Through Application...
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
apidays Munich 2025 - Integrate Your APIs into the New AI Marketplace, Senthi...
apidays Munich 2025 - The Double Life of the API Product Manager, Emmanuel Pa...
apidays Munich 2025 - Let’s build, debug and test a magic MCP server in Postm...
apidays Munich 2025 - The life-changing magic of great API docs, Jens Fischer...
apidays Munich 2025 - Automating Operations Without Reinventing the Wheel, Ma...
apidays Munich 2025 - Geospatial Artificial Intelligence (GeoAI) with OGC API...
apidays Munich 2025 - GraphQL 101: I won't REST, until you GraphQL, Surbhi Si...
apidays Munich 2025 - Effectively incorporating API Security into the overall...
apidays Munich 2025 - Federated API Management and Governance, Vince Baker (D...
apidays Munich 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (Aavista Oy)
apidays Munich 2025 - Streamline & Secure LLM Traffic with APISIX AI Gateway ...
apidays Munich 2025 - Building Telco-Aware Apps with Open Gateway APIs, Subhr...
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
apidays Helsinki & North 2025 - REST in Peace? Hunting the Dominant Design fo...
apidays Helsinki & North 2025 - Monetizing AI APIs: The New API Economy, Alla...
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
apidays Helsinki & North 2025 - APIs in the healthcare sector: hospitals inte...

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Cloud computing and distributed systems.
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Empathic Computing: Creating Shared Understanding
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
20250228 LYD VKU AI Blended-Learning.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Advanced Soft Computing BINUS July 2025.pdf
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
Unlocking AI with Model Context Protocol (MCP)
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Cloud computing and distributed systems.
Spectral efficient network and resource selection model in 5G networks
Empathic Computing: Creating Shared Understanding
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Diabetes mellitus diagnosis method based random forest with bat algorithm
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Advanced methodologies resolving dimensionality complications for autism neur...
GamePlan Trading System Review: Professional Trader's Honest Take

apidays LIVE New York 2021 - Designing API's: Less Data is More! by Damir Svrtan, Netflix

Editor's Notes

  • #2: I’m super glad I could present to you all today! I’m sad that we’re not all together at a nice location where we could all meet up! But at the same time, it’s great that we could all join this conference from across the globe! Let me introduce myself.
  • #4: I am based in San Francisco, and where I moved about 3 years ago. Prior to moving to San Francisco
  • #5: I use to live in Zagreb, the capital city of Croatia, a small country in south eastern europe. That’s where I grew up, spent the first 28 years of my life.
  • #6: Why is this topic relevant to me? I’ve been building APIs for the last 7 years, and I’ve seen a pattern where developers like to expose more data than is actually needed.
  • #7: What kind of overhead?
  • #8: Queries no one asked for End points no one is using Unused Functionality, extra fields, relationships That you have to maintain
  • #10: Through this talk, we are going to be building a …
  • #11: similar to Medium or dev.to
  • #12: Fairly simple blogging platform
  • #13: how not to over expose data on your APIs Or how to avoid building extra flexibility that no one asked for
  • #14: Generally, I see a pattern where developers try to be speculative about what’s going to be needed in the future, so they often over build their APIs
  • #15: I’m going to break this into 3 patterns of a bloated surface that I usually see.
  • #20: Why wouldn’t we expose the email field right away? We’re gonna spend more time exposing it if we need it afterwards, right? So we’re saving time for the business, right?
  • #22: Not making things up GDPR California privacy laws
  • #23: Marking the field as deprecated - if your API schema descriptiors allows that Or if a versioned API, new API version
  • #24: Emails, reaching out to clients Platform - really hard, give a few months of lead time Private API - smaller amount of clients, but a lot of communication nevertheless
  • #25: Sparse field sets No sparse field sets - no idea if you’re breaking clients Sparse field sets - you better have metrics / observability
  • #26: Multiple deploys It’s not just easy as removing a few lines of code
  • #28: Group of reviewers Green check mark next to the post title
  • #33: Sparsefield sets, clients can pick and choose fields they want to use Every time you load the post, you load the reviewers
  • #35: A lot of communication, emails, slack messages..
  • #36: … One thing we are not utilizing
  • #38: I’ve been through this many times, where I was removing stuff that no one asked for. And I guarantee it’s way easier to add in the future than it is to remove - sometimes additions to the API can be done within an hour, while removals take a lot of time. So that’s about exposing fields on queryable resources
  • #39: What kind of input fields? The payload your API accepts when mutating or changing data; in REST APIs that would be the data your API gets whenever a client initiates a POST or PUT request. Let’s look at an example
  • #43: All that you need is an id and a body
  • #46: Sure, the Comment does have a Post ID, but it doesn’t mean we are able to update it? No! These don’t have to match, you are supposed to build your apps acorrding to your business needs, and that business logic should be on the server, not on the client.
  • #48: they might get confused What happens if I send the same value? What happens if I send a different value? And then lastly…
  • #52: ready for extra flexibility in the future, but not extremely flexible now Scope out what is needed for your clients
  • #55: Let’s just enable them to not send that post ID.
  • #56: …What did we get with this?
  • #57: We need to handle both cases, when there is a post ID, and when there’s not
  • #59: Anytime you change some commenting logic, you need to reflect that in both scenarios Caching - two strategies?
  • #60: Gotta test both cases
  • #62: Gives the client less flexibility, but it’s not the flexibility they’ve ever asked for Gives you more flexibility in terms in changing
  • #64: Second part of the second principle Defensive Programming Ensure that your API is not going to get abused Let’s go with the same example
  • #66: Or a better version of this..
  • #72: breaking change Introducing a new query / endpoint
  • #73: Not so soon…
  • #74: The client was too lazy to actually do paginated requests… What happened?
  • #94: Figure out what is your domain and for whom your building your API - don’t play guessing games Don’t couple your APIs to specific implementations. Maybe today you have a relational database that is backing some of this data, tomorrow it might be some API that won’t have the same fields, and you might bring yourself more trouble than anything.
  • #95: Involve them early in the process - figure out what their needs are. Don’t try to be speculative.
  • #96: As you are building out a minimal schema that is not over bloated, you have to be responsive to feature requests
  • #98: There might be a little bit of speculation here if you’re building a platform and trying to get ahead of competitors and try to drive user adoption But even then, I would question how much this kind of speculation is worth.
  • #99: I have a coworker that worked on APIs that were deployed on premises for their clients. They would release these once every 6 months and they would have to do thousands of deployments every time they released. If they missed a field that a client might need, they would have to repeat the same redeployments, which would be very costly. This is very unique and you probably are not in this situation
  • #101: You might be able to spend your time more wisely by improving API documentation, improving slow queries etc. Exposing too much data can be highly unproductive. You know, there’s a saying…
  • #102: Even though we might think we are doing something good for our API clients, and being a good partner, that often is not the case.
  • #103: If you want to talk more about this topic, let’s talk afterwards or reach out to me on Twitter!