SlideShare a Scribd company logo
Advanced API Design
      How an awesome API can
               attract friends,
               make you rich,
         and change the world

                          Jon Dahl
                         @jondahl
                 jon@zencoder.com
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Application
Programming
Interface
User
Interface
Interface
Library
SDK
Net::SSH
Web Service
Simple
Object
Access
Protocol
Simple
Object
Access
Protocol
REST
HTTP
Web is an API
GET /records
POST /record/new
POST /record/new
<xml>
 <data>Foo</data>
</xml>
POST /record/new
{
    "data" : "foo"
}
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
(Don’t tell our investors that
we don’t have a real product)
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Some Examples
1. Second Interface
Flickr
Twitter
Linkedin
Facebook
Paypal
Google Maps
2. Internal APIs
Service Oriented Architecture
Mobile application backends
3. Core Tech
Amazon Web Services
Twilio
Geoloqi
Zencoder
Sendgrid
Factual
Spreedly
Recurly
Saplo
Tropo
4. Science Fiction
PiCloud
Amazon Mechanical Turk
...
so, how do you design a good API?
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Competitive
Advantage
REST conventions
GET      records
POST     jobs
PUT      messages
DELETE   servers
         users
HTTP codes
200 OK
201 Created
202 Accepted

400 Bad Request
401 Unauthorized
402 Payment Required
404 Not Found
409 Conflict
418 I’m a teapot
422 Unprocessable Entity

500 Internal Server Error
503 Service Unavailable
... and many more!
Version it
GET /api/records/38927

{
    "color" : "green",
    "velocity" : 1000000
}
GET /api/records/38927

{
    "color" : "10EE33",
    "velocity" : 1000000
}
GET /api/v1/records/38927

{
    "color" : "green",
    "velocity" : 1000000
}
GET /api/v2/records/38927

{
    "color" : "10EE33",
    "velocity" : 1000000
}
GET /api/records/38927?version=2

GET /api/v2/records/38927

GET /api/records/38927
Accept: application/json+v2
Smart validations
POST /api/jobs HTTP/1.1
Accept: application/json
Content-Type: application/json

{
    "api_key" : "Not A Real Key",
    "color" : "green"
}
HTTP/1.1 500 Internal Server Error
HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized

{
    "errors": [
      "api_key not found"
    ]
}
HTTP/1.1 401 Unauthorized

{
    "errors": [
      "api_key not found.",
      "api_key may not include spaces."
    ]
}
HTTP/1.1 401 Unauthorized

{
  "errors": [
    "api_key not found. Please log in to https://
example.com/account/api to retrieve your API
key.",
    "api_key may not include spaces."
  ]
}
POST /api/user HTTP/1.1
Accept: application/json
Content-Type: application/json

{
    "api_key" : "A23B92F281CC"
    "strength" : 18
}
HTTP/1.1 400 Bad Request
HTTP/1.1 400 Bad Request

{
  "errors": [
    "JSON is not valid. Syntax error,
unexpected TSTRING, expecting '}'
at line 2"
  ]
}
JSON + XML
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
POST /api/user HTTP/1.1
Accept: application/json
Content-Type: application/json

{
    "api_key" : "A23B92F281CC",
    "strength" : 18
}
params[:strength] # 18
respond_to do |wants|
  wants.json { render :json => @jobs.to_json }
  wants.xml { render :xml => @jobs.to_xml }
end
Document it
Zencoder::API.define_setting :audio_channels, :section => section
do |z|
  z.tip = "The number of audio channels: 1 or 2."
  z.description = %Q{
    <p>The number of audio channels to use: 1 (mono) or 2
(stereo).</p>
    <p>Note that mono AAC audio sometimes erroneously self-reports
as stereo when inspected. We recommend using iTunes to get the true
number of channels for AAC audio.</p>
    }
  z.data_type = "Integer"
  z.valid = "1 or 2"
  z.default = "1 if the original file is mono; otherwise, 2."
  z.example = "1"
  z.see_also = [:audio_bitrate, :audio_quality]
end
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Libraries
Support it
APIs are scary.
Make it fast
Rate limiting
loop { MyApi.create("data") }
Log requests
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Request builder
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
GET /api/ideas
Competitive
Advantage
1. Make friends
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Awesomeness is noticed
(Assymetrical value curve)
value
quality
value
quality
value
quality
Bus Driving




              value
   quality
Bus Driving




              value
   quality
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Sports




          value
quality
API design




             value
  quality
"I know the following statement is going to sound dramatic,
but it's the truth. Zencoder seriously uplifted my entire day.

The API is really well designed and has documentation for not
only what each value should be but also what an example
input/output would look like using the value. I had spent the
earlier part of the day working with a web service that is the
complete opposite of those things.

So when I started digging into Zencoder I felt like I was
witnessing a double rainbow. Then when I found the API
Builder, it went beyond a double rainbow to a level I can only
imagine is equal to witnessing a unicorn birth.”
2. Get rich
Software is eating
the world
Software is eating
the world
Cloud computing revenue forecast

$150B
                              $148.8B




$100B


               $68.3B
 $50B




  $0B
                2010           2014

  Source: Gartner 2010
Need an idea?
API to
API to
the government
API to
your body
API to
manufacturing
3. Change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
In 2000...the cost of a customer running a basic
Internet application was approximately $150,000
a month. Running that same application today in
Amazon's cloud costs about $1,500 a month.

                              Mark Andreessen,
             “Why Software Is Eating The World”
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
1,000 CPU cores:
1,000 CPU cores:
$204
50 phone numbers:
50 phone numbers:
$50
POST /api/awesome_things HTTP/1.1

{
    "team_size" : 3,
    "productivity" : "10x"
}
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Advanced API Design: how an awesome API can help you make friends, get rich, and change the world
Jon Dahl
        @jondahl
jon@zencoder.com

More Related Content

PPT
API 101 - Understanding APIs.
PDF
The Enterprise Architecture You Always Wanted
PDF
Why Javascript is the glue of APIs?
PDF
REST APIs, Girls Who Code
PDF
APIs explained for product managers
PPTX
API Trends: What to expect in 2012
PPTX
Netflix API
PDF
Better Laziness Through Hypermedia -- Designing a Hypermedia Client
API 101 - Understanding APIs.
The Enterprise Architecture You Always Wanted
Why Javascript is the glue of APIs?
REST APIs, Girls Who Code
APIs explained for product managers
API Trends: What to expect in 2012
Netflix API
Better Laziness Through Hypermedia -- Designing a Hypermedia Client

What's hot (19)

PDF
What Makes a Great Open API?
PPTX
Introduction to Artificial Intelligence (AI) at Amazon
ZIP
The Power of Open Data
PPTX
Presentation to ESPN about the Netflix API
PDF
Introduction to Facebook Pop
PPTX
The future-of-netflix-api
PPTX
Web2expo 2011u
PPTX
Building AI-powered Apps on AWS
PDF
Heroku addons development - Nov 2011
KEY
Pragmatic RESTful API Design: Apigee Webinar
PPTX
BrightonSEO 2020 - Mastering The API and Having Fun Along The Way
PDF
Amazon Alexa: our successes and fails
PPTX
Git store
PDF
"Managing API Complexity". Matthew Flaming, Temboo
PDF
Digital Muse “Girl Tech Fest - AWS Alexa Skills Coding Workshop
PDF
Alexa, nice to meet you!
PPTX
API Design - 3rd Edition
PPT
API 101 - Understanding APIs
PPTX
Alexa in 10 minutes
What Makes a Great Open API?
Introduction to Artificial Intelligence (AI) at Amazon
The Power of Open Data
Presentation to ESPN about the Netflix API
Introduction to Facebook Pop
The future-of-netflix-api
Web2expo 2011u
Building AI-powered Apps on AWS
Heroku addons development - Nov 2011
Pragmatic RESTful API Design: Apigee Webinar
BrightonSEO 2020 - Mastering The API and Having Fun Along The Way
Amazon Alexa: our successes and fails
Git store
"Managing API Complexity". Matthew Flaming, Temboo
Digital Muse “Girl Tech Fest - AWS Alexa Skills Coding Workshop
Alexa, nice to meet you!
API Design - 3rd Edition
API 101 - Understanding APIs
Alexa in 10 minutes
Ad

Viewers also liked (20)

PPTX
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
PDF
Streaming Api Design with Akka, Scala and Spray
PDF
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
PDF
APIDays - API Design Workshop
PDF
Big and fast a quest for relevant and real-time analytics
PDF
Domain Driven Design
PPTX
Domain Driven Design
PDF
Refactoring for Domain Driven Design
PDF
Developing event-driven microservices with event sourcing and CQRS (phillyete)
PPTX
Designing APIs and Microservices Using Domain-Driven Design
PDF
Design First API's with RAML and SoapUI
PPT
Domain Driven Design (DDD)
PPTX
A Practical Guide to Domain Driven Design: Presentation Slides
PDF
Some REST Design Patterns (and Anti-Patterns) - SOA Symposium 2009
PPTX
Domain Driven Design 101
PDF
Java 8 new features or the ones you might actually use
PDF
Domain Driven Design
PDF
Microservices: Where do they fit within a rapidly evolving integration archit...
PDF
Stateless authentication for microservices
PPTX
Microservices + Oracle: A Bright Future
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
Streaming Api Design with Akka, Scala and Spray
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
APIDays - API Design Workshop
Big and fast a quest for relevant and real-time analytics
Domain Driven Design
Domain Driven Design
Refactoring for Domain Driven Design
Developing event-driven microservices with event sourcing and CQRS (phillyete)
Designing APIs and Microservices Using Domain-Driven Design
Design First API's with RAML and SoapUI
Domain Driven Design (DDD)
A Practical Guide to Domain Driven Design: Presentation Slides
Some REST Design Patterns (and Anti-Patterns) - SOA Symposium 2009
Domain Driven Design 101
Java 8 new features or the ones you might actually use
Domain Driven Design
Microservices: Where do they fit within a rapidly evolving integration archit...
Stateless authentication for microservices
Microservices + Oracle: A Bright Future
Ad

Similar to Advanced API Design: how an awesome API can help you make friends, get rich, and change the world (20)

PPTX
Building a REST API for Longevity
PDF
zendframework2 restful
PDF
Api Design Patterns Meap V07 Meap V07 Jj Geewax
PDF
Design Web Api
PDF
Web APIs: The future of software
PDF
Consumer centric api design v0.4.0
PDF
A_Complete_Guide_to_API_Development.pdf
PDF
Build your APIs with apigility
PDF
apidays LIVE Helsinki & North 2022_Building an Accessible API Spec with Tradi...
PDF
Session 8 Android Web Services - Part 1.pdf
PDF
Ebook undisturbed rest-v1 [res_tful apis]
PDF
Guide To API Development – Cost, Importance, Types, Tools, Terminology, and B...
PDF
Coding 100-session-slides
PDF
How to Develop APIs - Importance, Types, Tools, Terminology, and Best Practic...
PPTX
API Design Best Practices & Tech Talk : API Craft Meetup @ Apigee
PPTX
advanced computer network, about computer
PDF
Transform Your Operations with Cutting-Edge API Development Services.pdf
PPTX
Jones "Working with Scholarly APIs: A NISO Training Series, Session One: Foun...
PDF
Создание API, которое полюбят разработчики. Глубокое погружение
PPTX
API Testing Basics.pptx
Building a REST API for Longevity
zendframework2 restful
Api Design Patterns Meap V07 Meap V07 Jj Geewax
Design Web Api
Web APIs: The future of software
Consumer centric api design v0.4.0
A_Complete_Guide_to_API_Development.pdf
Build your APIs with apigility
apidays LIVE Helsinki & North 2022_Building an Accessible API Spec with Tradi...
Session 8 Android Web Services - Part 1.pdf
Ebook undisturbed rest-v1 [res_tful apis]
Guide To API Development – Cost, Importance, Types, Tools, Terminology, and B...
Coding 100-session-slides
How to Develop APIs - Importance, Types, Tools, Terminology, and Best Practic...
API Design Best Practices & Tech Talk : API Craft Meetup @ Apigee
advanced computer network, about computer
Transform Your Operations with Cutting-Edge API Development Services.pdf
Jones "Working with Scholarly APIs: A NISO Training Series, Session One: Foun...
Создание API, которое полюбят разработчики. Глубокое погружение
API Testing Basics.pptx

More from Jonathan Dahl (9)

PDF
The impact of encoding on content delivery: four ways to optimize video quality
PDF
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
PDF
Advanced API Design: how an awesome API can attract friends, make you rich, a...
PDF
Programming and Minimalism: Lessons from Orwell and the Clash
PDF
Aristotle and the Art of Software Development (Agile 2009)
ZIP
Rails and alternative ORMs
PDF
Aristotle and the Art of Software Development
PDF
EC2, MapReduce, and Distributed Processing
PDF
Asynchronous Processing with Ruby on Rails (RailsConf 2008)
The impact of encoding on content delivery: four ways to optimize video quality
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
Advanced API Design: how an awesome API can attract friends, make you rich, a...
Programming and Minimalism: Lessons from Orwell and the Clash
Aristotle and the Art of Software Development (Agile 2009)
Rails and alternative ORMs
Aristotle and the Art of Software Development
EC2, MapReduce, and Distributed Processing
Asynchronous Processing with Ruby on Rails (RailsConf 2008)

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Modernizing your data center with Dell and AMD
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
KodekX | Application Modernization Development
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation theory and applications.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Spectral efficient network and resource selection model in 5G networks
The Rise and Fall of 3GPP – Time for a Sabbatical?
Dropbox Q2 2025 Financial Results & Investor Presentation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Modernizing your data center with Dell and AMD
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
CIFDAQ's Market Insight: SEC Turns Pro Crypto
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
KodekX | Application Modernization Development
MYSQL Presentation for SQL database connectivity
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Chapter 3 Spatial Domain Image Processing.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation theory and applications.pdf
Digital-Transformation-Roadmap-for-Companies.pptx

Advanced API Design: how an awesome API can help you make friends, get rich, and change the world