Top Banner
What Makes a Great Open API? John Musser, ProgrammableWeb @johnmusser OSCON 2012
72

What Makes a Great Open API?

Sep 08, 2014

Download

Technology

jmusser

What is it that turns an ordinary API into a great API? This talk from OSCON 2012 outlines the 5 "keys" to having a great API. Lots of examples from successful real-world APIs are used to highlight what matters. Also, this talk reveals 7 lesser known but very important "API secrets".
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: What Makes a Great Open API?

What Makes a Great Open API?

John  Musser,  ProgrammableWeb  @johnmusser  OSCON  2012  

   

Page 2: What Makes a Great Open API?

7  years  

6,000  APIs  

3,000  news  sto

ries  

Page 3: What Makes a Great Open API?

Why does having a great API

matter?

Page 4: What Makes a Great Open API?

API growth rate Based on directory of 6,000 web APIs listed at ProgrammableWeb, May 2012

Page 5: What Makes a Great Open API?

API growth rate Based on directory of 6,000 web APIs listed at ProgrammableWeb, May 2012

8  Years  

18  Months  

9  Months  

6  Months  

4  Months  

3  Months  

Page 6: What Makes a Great Open API?

API Billionaires Club 5 billion API calls / day (April 2010)

1 billion API calls / day (Q1 2012)

5 billion API calls / day (October 2009)

13 billion API calls / day (May 2011)

1.4 billion API calls / day (May 2012)

1 billion API calls / day (January 2012)

1.1 billion API calls / day (April 2011)

1 billion API calls / day (May 2012)

Page 7: What Makes a Great Open API?

Apps & devices everywhere

Page 8: What Makes a Great Open API?

5 Keys to a Great API Valuable Planned Flexible

Managed Supported

Page 9: What Makes a Great Open API?

5 Keys to a Great API A valuable service (data, function, audience, …)

A plan and a business model Simple, flexible, easily adopted

Managed and measured Great developer support

Page 10: What Makes a Great Open API?

Each “key” has two sides:

business technology & (each supports the other)

Page 11: What Makes a Great Open API?

Each “key” has two sides:

business technology & (today’s talk)

Page 12: What Makes a Great Open API?

These are really, really hard to do

right

API SECRET #1

Page 13: What Makes a Great Open API?

5 Keys to a Great API Valuable Planned Flexible

Managed Supported

Page 14: What Makes a Great Open API?

Valuable Service

Page 15: What Makes a Great Open API?

Valuable Data

Page 16: What Makes a Great Open API?

Valuable Audience

Page 17: What Makes a Great Open API?

Valuable Function

Page 18: What Makes a Great Open API?

Valuable Marketplace

Page 19: What Makes a Great Open API?

Valuable Access

Page 20: What Makes a Great Open API?

A very valuable service hides many API sins

API SECRET #2

Page 21: What Makes a Great Open API?

The API value corollary

A great API on a bad service is lipstick on a pig

the API Value Corollary

Page 22: What Makes a Great Open API?

5 Keys to a Great API Valuable Planned Flexible

Managed Supported

Page 23: What Makes a Great Open API?

5 Keys to a Great API Valuable

Planned (designed) Flexible

Managed Supported

Page 24: What Makes a Great Open API?

Your first two design questions

What is the goal of this API? (purpose)

Who will be using this API? (audience)

Page 25: What Makes a Great Open API?

You’ll make many design choices What protocol(s) will I support?

What data format(s) to provide?

How will I manage security?

Which design patterns to use? Hmm, are there any?

Oh, right, I need to do versioning too…

Should I use an open source framework?

Page 26: What Makes a Great Open API?

GET  h@p://example.org/stock/IBM  POST  /GetStock  HTTP/1.1  Host:  www.example.org  Content-­‐Type:  applicaRon/soap+xml    <?xml  version="1.0"?>  <soap:Envelope  xmlns:soap="h@p://www.w3.org/2001/12/soap-­‐envelope"  soap:encodingStyle="h@p://www.w3.org/2001/12/soap-­‐encoding">    <soap:Body  xmlns:m="h@p://www.example.org/stock">      <m:GetStockPrice>          <m:StockName>IBM</m:StockName>      </m:GetStockPrice>  </soap:Body>  </soap:Envelope>  

What’s the price of IBM?

Page 27: What Makes a Great Open API?

GET  h@p://example.org/stock/IBM  POST  /GetStock  HTTP/1.1  Host:  www.example.org  Content-­‐Type:  applicaRon/soap+xml    <?xml  version="1.0"?>  <soap:Envelope  xmlns:soap="h@p://www.w3.org/2001/12/soap-­‐envelope"  soap:encodingStyle="h@p://www.w3.org/2001/12/soap-­‐encoding">    <soap:Body  xmlns:m="h@p://www.example.org/stock">      <m:GetStockPrice>          <m:StockName>IBM</m:StockName>      </m:GetStockPrice>  </soap:Body>  </soap:Envelope>  

SOAP REST

Page 28: What Makes a Great Open API?

API protocols and styles Based on directory of 5,100 web APIs listed at ProgrammableWeb, February 2012

Page 29: What Makes a Great Open API?

A great API doesn’t just ask

“am I RESTful enough? ”

API SECRET #3

Page 30: What Makes a Great Open API?

Daniel Jacobson, Netflix Engineering Blog, July 9, 2012

Page 31: What Makes a Great Open API?

Daniel Jacobson, Netflix Engineering Blog, July 9, 2012

Page 32: What Makes a Great Open API?

A great API understands its

audience

another moral of that story is…

Page 33: What Makes a Great Open API?

Your audience may <3 SOAP, really

50+ finance APIs, 5 billion+ calls/month

Page 34: What Makes a Great Open API?

Data format? It depends…

XML, JSON, RSS, Atom, YAML, iCalendar, CSV, Serialized PHP, HTML, PNG, GeoRSS, vCard, Text, RDF, OPML,

MediaRSS, VML, TV-Anytime, hCalendar, FOAF, XSPF, SQL, GML, CDF

Data formats supported by APIs on ProgrammableWeb, May 2012

Page 35: What Makes a Great Open API?

{          "symbol":  ”IBM",          "price":  94.72,  }  

<?xml  version="1.0"?>  <soap:Envelope  xmlns:soap="h@p://www.w3.org/2001/12/soap-­‐envelope"  soap:encodingStyle="h@p://www.w3.org/2001/12/soap-­‐encoding">    <soap:Body  xmlns:m="h@p://www.example.org/stock">      <m:GetStockPriceResponse>          <m:Price>34.5</m:Price>      </m:GetStockPriceResponse>  </soap:Body>    </soap:Envelope>  

What’s the price of IBM?

Page 36: What Makes a Great Open API?

{          "symbol":  ”IBM",          "price":  94.72,  }  

<?xml  version="1.0"?>  <soap:Envelope  xmlns:soap="h@p://www.w3.org/2001/12/soap-­‐envelope"  soap:encodingStyle="h@p://www.w3.org/2001/12/soap-­‐encoding">    <soap:Body  xmlns:m="h@p://www.example.org/stock">      <m:GetStockPriceResponse>          <m:Price>34.5</m:Price>      </m:GetStockPriceResponse>  </soap:Body>    </soap:Envelope>  

JSON XML

Page 37: What Makes a Great Open API?

Percentage of REST APIs supporting JSON Based on directory of 5,800 web APIs listed at ProgrammableWeb, May 2012

Page 38: What Makes a Great Open API?

Want to discuss API design?

Check out API Craft http://groups.google.com/group/api-craft

Page 39: What Makes a Great Open API?

5 Keys to a Great API Valuable Planned

(simple) Flexible (easily adopted)

Managed Supported

Page 40: What Makes a Great Open API?

API simplicity continuum

Simple Complex

“As simple as possible, but no simpler”

Page 41: What Makes a Great Open API?

What makes an API flexible? Provides choices

data format, protocol, version

Gives developer control partial queries & updates, batch operations

Offers advanced options webhooks, streaming, caching

Page 42: What Makes a Great Open API?

What’s your TTFHW? Time To First “Hello World” aka: how long from zero to 60?

Page 43: What Makes a Great Open API?

6 ways to accelerate TTFHW

Page 44: What Makes a Great Open API?

#1) Make it clear what you do

Page 45: What Makes a Great Open API?

#2) Offer “Free” or “Trial” API access

Page 46: What Makes a Great Open API?

(or, even both free & trial)

Page 47: What Makes a Great Open API?

#3) Fast, automated signup

(so fast, you can even skip this step till you’re convinced…)

Page 48: What Makes a Great Open API?

#4) Clear, accurate documentation

Page 49: What Makes a Great Open API?

#5) Copious code samples

Page 50: What Makes a Great Open API?

#6) Provide tools

Twilio’s debugger

Stripe’s dashboard

Wordnik’s Swagger & Mashery’s I/O Docs

Google’s OAuth Playground

Apigee’s API console

Page 51: What Makes a Great Open API?

5 Keys to a Great API Valuable Planned Flexible

Managed (and measured) Supported

Page 52: What Makes a Great Open API?

What to manage & measure? Manage

Security Key management Monitoring Reporting Scaling Rate limiting Versioning

Measure

Performance Developers and apps Quality Marketing Revenue Volume Trends

Page 53: What Makes a Great Open API?

API versioning in REST Where   What   Who   Example  

Path  segment   Date   Twilio   /2010-­‐04-­‐01/…  

Path  segment   Number   Twi@er   /1/…  

Path  segment   ‘v’  +  Number   LinkedIn   /v1/…  

Query  string   Number   Google   ?v=2  

Custom  HTTP  header   Number   Google   GData-­‐Version:  2  

HTTP  Accept  header   Number   Github   applicaRon/vnd.github[.version]  

Page 54: What Makes a Great Open API?

It matters less how you version than you do

version

API SECRET #4

Page 55: What Makes a Great Open API?

API security baseline Today:

SSL as option OAuth 2.0 (one of the few API standards with traction)

Future:

SSL required (many major APIs moving to SSL only)

OpenID Connect (it’s very early today)

Page 56: What Makes a Great Open API?

Great APIs get measured Great APIs get measured

Page 57: What Makes a Great Open API?

Metrics that matter Traffic

Total calls Top methods

Call chains Quota faults

Developers Total developers

Active developers Top developers Trending apps

Retention

Service Performance Availability Error rates

Code defects

Marketing Dev registrations Dev portal funnel

Traffic sources Event metrics

Support Support tickets Response times

Community metrics

Business Direct revenue

Indirect revenue Market share

Costs

Page 58: What Makes a Great Open API?

Great APIs prioritize what they want to

measure

API SECRET #5

Page 59: What Makes a Great Open API?

“The absence of limitations is the

enemy of art” Orson Welles

Page 60: What Makes a Great Open API?

5 Keys to a Great API Valuable Planned Flexible

Managed Supported

Page 61: What Makes a Great Open API?

What makes an API supported? Great developer experience (DX)

signup, guides, reference, SDKs, pricing, clear ToS

Great support / evangelism teams active, engaged, listening, responding, at events

Communication & community forum, blog, social media, email, app gallery

Page 62: What Makes a Great Open API?

What makes an API supported? Great developer experience (DX)

Signup, guides, reference, SDKs, pricing, legal

Great support / evangelism teams active, engaged, listening, responding

Communication & community forum, blog, social media, email, events, clear ToS

And  everyt

hing  

covered  unde

r  

TTFHW  

Page 63: What Makes a Great Open API?

developerexperience.org

see also developer-support-handbook.appspot.com

Page 64: What Makes a Great Open API?

Great DX separates the best APIs from

the rest

API SECRET #6

Page 65: What Makes a Great Open API?

Covering your DX checklist

Page 66: What Makes a Great Open API?

Does API design impact support? Let me count the ways…

For example, look at Twilio’s error response

Page 67: What Makes a Great Open API?

Community: a core tenet of great open APIs and open source

Page 68: What Makes a Great Open API?

5 Keys to a Great API Valuable Planned Flexible

Managed Supported

And  one  more  

thing…  

Page 69: What Makes a Great Open API?

Top 10 API worst practices 10. Poor error handing 9. REST APIs that ignore HTTP rules 8. Exposing your raw underlying data model 7. Security complexity

6. Unexpected & undocumented releases 5. Poor developer experience 4. Expect an MVC framework ‘gives’ you a great API 3. Assume if you build it they will come 2. Inadequate support 1. Poor documentation

Page 70: What Makes a Great Open API?

A great API is a journey,

not a destination

API SECRET #7

Page 71: What Makes a Great Open API?

Thank You

QuesRons,  ideas,  [email protected]  

@johnmusser    

Page 72: What Makes a Great Open API?

Photo  credits  Pig:  h@p://www.flickr.com/photos/babasteve/7341687640/  Race  car:  h@p://www.flickr.com/photos/lim_lik_wei/3270522646/  Stopwatch:  h@p://www.flickr.com/photos/purplemapish/3020016417/  Hackers:  h@p://www.flickr.com/photos/hackny/5684846071/  Winding  road:  h@p://www.flickr.com/photos/ma@hewthecoolguy/7518274258/