SlideShare a Scribd company logo
1 of 15
Download to read offline
twilio
         CLOUD COMMUNICATIONS




      Designing the Best
Telecommunications API
   Tim Milliron, Director of Engineering
                            @timmilliron
Who is twilio?
          RESTful web APIs to automate
          Voice & SMS communications


      Voice             SMS           Phone
                                     Numbers
•   Inbound        • Incoming      • PhoneNumber
•   Outbound       • Outgoing        Provisioning
•   Mobile VoIP    • Short Codes   • ShortCode
•   Browser VoIP                     Applications
(415) 233-WAZA
    • Find & buy a number:
curl -u $U:$P
https://api.twilio.com/2010-04-01/Accounts/AC123/
AvailablePhoneNumbers/US/Local?Contains=415***WAZA

curl -u $U:$P -d “PhoneNumber=415233WAZA”
https://api.twilio.com/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/


    • Make an outgoing call:
curl -u $U:$P -d “Url=www.example.com/outgoing.xml”
-d “From=4152339292” -d “To=4158675309”
https://api.twilio.com/2010-04-01/Accounts/AC123/Calls/



    • Receive an incoming call:
<Response>
    <Say>Thanks for calling the Waza Twilio number! Huzzah!</Say>
    <Sms>Heroku’s Waza Rocks!</Sms>
</Response>
7 Principles
#1 APIs are for Abstraction
Example: DIDs
  DID	
  (Direct	
  Inward	
  Dial)	
  —	
  Inbound-­‐only	
  phone	
  number	
  
  assigned	
  to	
  a	
  group	
  of	
  phone	
  lines	
  that	
  allows	
  a	
  
  phone	
  system	
  to	
  route	
  to	
  a	
  unique	
  location	
  or	
  person.	
  
  A	
  group	
  of	
  DIDs	
  is	
  often	
  assigned	
  to	
  a	
  single	
  trunk	
  
  group.	
  DID	
  numbers	
  are	
  not	
  sent	
  out	
  as	
  the	
  ANI	
  when	
  
  the	
  caller	
  places	
  an	
  outbound	
  call.



Developers don’t give a f*** about DIDs
  twilio’s API talks PhoneNumbers
  (they work for incoming & outgoing)
#2 What’s the noun?
Speak resources:
  GET api.twilio.com/.../Calls
  GET api.twilio.com/.../Calls/CA123
  POST api.twilio.com/.../Calls


Not RPC:
  GET api.twilio.com/.../GetCalls/
  POST api.twilio.com/.../PlaceCall
#3 Be RESTful
Hypermedia for sub-resource traversal:
  <Account>
     <Sid>AC123</Sid>
     <OwnerAccountSid>AC456</OwnerAccountSid>
     <FriendlyName>tim@twilio.com's Account</FriendlyName>
     <Status>active</Status>
     ...
     <Uri>
        /2010-04-01/Accounts/AC123
     </Uri>
     <SubresourceUris>
        <AvailablePhoneNumbers>
           /2010-04-01/Accounts/AC123/AvailablePhoneNumbers
        </AvailablePhoneNumbers>
        <Calls>
           /2010-04-01/Accounts/AC123/Calls
        </Calls>
        ...
     </SubresourceUris>
  </Account>
#3 Be RESTful
Hypermedia for list traversal:
 <SMSMessages page="0" numpages="16" pagesize="50" total="780"
 start="0" end="49" uri="/2010-04-01/Accounts/AC123/SMS/
 Messages" firstpageuri="/2010-04-01/Accounts/AC123/SMS/
 Messages?Page=0&PageSize=50" previouspageuri="" nextpageuri="/
 2010-04-01/Accounts/AC123/SMS/Messages?Page=1&PageSize=50"
 lastpageuri="/2010-04-01/Accounts/AC123/SMS/Messages?
 Page=15&PageSize=50">
    ...
 </SMSMessages>
#4 The API Giveth...
... but the API can’t (usually) taketh away


It’s much easier to add something
than to remove something
  ➡ Get it in developers’ hands,
      see what use cases develop.
  ➡ Then, aggressively add
      frequently-requested features
#5 The Smallest API Possible...


                    twilio.com/
                     authorize



                   access_token=
                     xxxyyyzzz

/Calls?access_token=xxxyyyzzz
/IncomingPhoneNumbers?access_token=xxxyyyzzz
...
#5 The Smallest API Possible...


                    twilio.com/
                     authorize



                   account_sid=
                      AC678

/Calls
/IncomingPhoneNumbers
...
#6 ...But No Smaller
“As close to C as possible, but no closer”
 - Bjarne Stroustrup, creator of C++


Make the common case easy.

This works, and it’s generic:
   curl api.twilio.com/.../AvailablePhoneNumbers?
   Contains=510*******



But, this is what most developers want:
   curl api.twilio.com/.../AvailablePhoneNumbers?
   AreaCode=510
#7 Don’t Settle
• Late changes are OK
• Don’t be afraid to version
  (with good reason)
• Get feedback early, often, & throughout
     Discuss, spec, write, try it, rewrite
      discuss it some more, rewrite again
Process    Perspective
 Discuss      Developers
              Developers
  Spec
              Developers

  Build
twilio
        CLOUD COMMUNICATIONS




Tim Milliron, Director of Engineering
                         @timmilliron

More Related Content

What's hot

Final Twilio Under the Radar 2009 Cloud
Final Twilio Under the Radar 2009 CloudFinal Twilio Under the Radar 2009 Cloud
Final Twilio Under the Radar 2009 Cloud
Dealmaker Media
 

What's hot (20)

Twilio SMS - API for Sending & Receiving SMS Messages
Twilio SMS - API for Sending & Receiving SMS MessagesTwilio SMS - API for Sending & Receiving SMS Messages
Twilio SMS - API for Sending & Receiving SMS Messages
 
AWS Customer Presentation - Twilio
AWS Customer Presentation - TwilioAWS Customer Presentation - Twilio
AWS Customer Presentation - Twilio
 
Smarter SIP Trunks: 6 Ways You Can Save Time and Get More Features
Smarter SIP Trunks: 6 Ways You Can Save Time and Get More FeaturesSmarter SIP Trunks: 6 Ways You Can Save Time and Get More Features
Smarter SIP Trunks: 6 Ways You Can Save Time and Get More Features
 
Twilio Signal 2016 Real-time Communications Overview
Twilio Signal 2016 Real-time Communications OverviewTwilio Signal 2016 Real-time Communications Overview
Twilio Signal 2016 Real-time Communications Overview
 
Twilio Signal 2016 Keynote
Twilio Signal 2016 Keynote Twilio Signal 2016 Keynote
Twilio Signal 2016 Keynote
 
Twilio API: Build SMS Text Message Into Web Apps
Twilio API: Build SMS Text Message Into Web AppsTwilio API: Build SMS Text Message Into Web Apps
Twilio API: Build SMS Text Message Into Web Apps
 
What Can You Do With Twilio
What Can You Do With TwilioWhat Can You Do With Twilio
What Can You Do With Twilio
 
Twilio Presentation
Twilio PresentationTwilio Presentation
Twilio Presentation
 
Twilio Signal 2016 Build Your Own Cloud Enterprise VoIP
Twilio Signal 2016 Build Your Own Cloud Enterprise VoIPTwilio Signal 2016 Build Your Own Cloud Enterprise VoIP
Twilio Signal 2016 Build Your Own Cloud Enterprise VoIP
 
Final Twilio Under the Radar 2009 Cloud
Final Twilio Under the Radar 2009 CloudFinal Twilio Under the Radar 2009 Cloud
Final Twilio Under the Radar 2009 Cloud
 
Tropo Presentation for TADHack
Tropo Presentation for TADHackTropo Presentation for TADHack
Tropo Presentation for TADHack
 
Cloud Telephony Public
Cloud Telephony PublicCloud Telephony Public
Cloud Telephony Public
 
Otra forma de hacer aplicaciones de telefonía
Otra forma de hacer aplicaciones de telefoníaOtra forma de hacer aplicaciones de telefonía
Otra forma de hacer aplicaciones de telefonía
 
How the Realtime Web is influencing the future of communications
How the Realtime Web is influencing the future of communicationsHow the Realtime Web is influencing the future of communications
How the Realtime Web is influencing the future of communications
 
Create an IVR that Keeps Up with Your Customers
Create an IVR that Keeps Up with Your CustomersCreate an IVR that Keeps Up with Your Customers
Create an IVR that Keeps Up with Your Customers
 
Building A Great API - Evan Cooke, Cloudstock, December 2010
Building A Great API - Evan Cooke, Cloudstock, December 2010Building A Great API - Evan Cooke, Cloudstock, December 2010
Building A Great API - Evan Cooke, Cloudstock, December 2010
 
Twilio MMS Deep Dive
Twilio MMS Deep DiveTwilio MMS Deep Dive
Twilio MMS Deep Dive
 
Twilio Signal 2016 Using Add-ons
Twilio Signal 2016 Using Add-onsTwilio Signal 2016 Using Add-ons
Twilio Signal 2016 Using Add-ons
 
Twilio using Groovy Grails
Twilio using Groovy GrailsTwilio using Groovy Grails
Twilio using Groovy Grails
 
Twilio Signal 2016 Taking Your SMS App Global
Twilio Signal 2016 Taking Your SMS App GlobalTwilio Signal 2016 Taking Your SMS App Global
Twilio Signal 2016 Taking Your SMS App Global
 

Similar to 7 Principles of API Design - Waza

Real time voice call integration - Confoo 2012
Real time voice call integration - Confoo 2012Real time voice call integration - Confoo 2012
Real time voice call integration - Confoo 2012
Michael Peacock
 
How serverless changes the cost paradigm
How serverless changes the cost paradigmHow serverless changes the cost paradigm
How serverless changes the cost paradigm
Yan Cui
 
SignalR Intro + WPDev integration @ Codetock
SignalR Intro + WPDev integration @ CodetockSignalR Intro + WPDev integration @ Codetock
SignalR Intro + WPDev integration @ Codetock
Sam Basu
 

Similar to 7 Principles of API Design - Waza (20)

How to Implement Conversational IVR
How to Implement Conversational  IVRHow to Implement Conversational  IVR
How to Implement Conversational IVR
 
Real time voice call integration - Confoo 2012
Real time voice call integration - Confoo 2012Real time voice call integration - Confoo 2012
Real time voice call integration - Confoo 2012
 
Twilio - Social App Workshop - 2010-07-24
Twilio - Social App Workshop - 2010-07-24Twilio - Social App Workshop - 2010-07-24
Twilio - Social App Workshop - 2010-07-24
 
IoT to Human interactions - Stève Sfartz - Codemotion Milan 2016
IoT to Human interactions - Stève Sfartz - Codemotion Milan 2016IoT to Human interactions - Stève Sfartz - Codemotion Milan 2016
IoT to Human interactions - Stève Sfartz - Codemotion Milan 2016
 
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
DevNet @TAG - Spark & Tropo APIs - Milan/Rome May 2016
 
How to Build Advanced Voice Assistants and Chatbots
How to Build Advanced Voice Assistants and ChatbotsHow to Build Advanced Voice Assistants and Chatbots
How to Build Advanced Voice Assistants and Chatbots
 
Chris Matthieu's Presentation at Emerging Communication Conference & Awards 2...
Chris Matthieu's Presentation at Emerging Communication Conference & Awards 2...Chris Matthieu's Presentation at Emerging Communication Conference & Awards 2...
Chris Matthieu's Presentation at Emerging Communication Conference & Awards 2...
 
Subscribed 2017: Understanding Zuora’s API Framework
Subscribed 2017: Understanding Zuora’s API FrameworkSubscribed 2017: Understanding Zuora’s API Framework
Subscribed 2017: Understanding Zuora’s API Framework
 
Astricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installationsAstricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installations
 
The Real World - Plugging the Enterprise Into It (nodejs)
The Real World - Plugging  the Enterprise Into It (nodejs)The Real World - Plugging  the Enterprise Into It (nodejs)
The Real World - Plugging the Enterprise Into It (nodejs)
 
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
 
Look Who's Talking
Look Who's TalkingLook Who's Talking
Look Who's Talking
 
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTCKamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
 
Expert Days 2011: The VP R&D Open Seminar: Systems Performance Seminar
Expert Days 2011: The VP R&D Open Seminar: Systems Performance Seminar Expert Days 2011: The VP R&D Open Seminar: Systems Performance Seminar
Expert Days 2011: The VP R&D Open Seminar: Systems Performance Seminar
 
Contact Center fundamentals for Kids
Contact Center fundamentals for KidsContact Center fundamentals for Kids
Contact Center fundamentals for Kids
 
The Momentum of Collaboration and the Customer Experience
The Momentum of Collaboration and the Customer ExperienceThe Momentum of Collaboration and the Customer Experience
The Momentum of Collaboration and the Customer Experience
 
How serverless changes the cost paradigm
How serverless changes the cost paradigmHow serverless changes the cost paradigm
How serverless changes the cost paradigm
 
SignalR Intro + WPDev integration @ Codetock
SignalR Intro + WPDev integration @ CodetockSignalR Intro + WPDev integration @ Codetock
SignalR Intro + WPDev integration @ Codetock
 
Getting Started with Twilio
Getting Started with TwilioGetting Started with Twilio
Getting Started with Twilio
 
BlackHat Hacking - Hacking VoIP.
BlackHat Hacking - Hacking VoIP.BlackHat Hacking - Hacking VoIP.
BlackHat Hacking - Hacking VoIP.
 

More from Twilio Inc

More from Twilio Inc (20)

Salesforce’s Andy Kung on the Power of CRM Integrations
 Salesforce’s Andy Kung on the Power of CRM Integrations Salesforce’s Andy Kung on the Power of CRM Integrations
Salesforce’s Andy Kung on the Power of CRM Integrations
 
All Web Leads’ Lorena Lauv on How to Scale a Virtual Call Center
All Web Leads’ Lorena Lauv on How to Scale a Virtual Call CenterAll Web Leads’ Lorena Lauv on How to Scale a Virtual Call Center
All Web Leads’ Lorena Lauv on How to Scale a Virtual Call Center
 
Why Mobile Messaging Works?
Why Mobile Messaging Works?Why Mobile Messaging Works?
Why Mobile Messaging Works?
 
Understand How Consumers Use Messaging
Understand How Consumers Use MessagingUnderstand How Consumers Use Messaging
Understand How Consumers Use Messaging
 
How To Track Calls Using Twilio?
How To Track Calls Using Twilio?How To Track Calls Using Twilio?
How To Track Calls Using Twilio?
 
Twilio Signal 2016 WebRTC Reborn
Twilio Signal 2016 WebRTC RebornTwilio Signal 2016 WebRTC Reborn
Twilio Signal 2016 WebRTC Reborn
 
Twilio Signal 2016 Technical Blogging
Twilio Signal 2016 Technical Blogging Twilio Signal 2016 Technical Blogging
Twilio Signal 2016 Technical Blogging
 
Twilio Signal 2016 Serverless Contact Center
Twilio Signal 2016 Serverless Contact CenterTwilio Signal 2016 Serverless Contact Center
Twilio Signal 2016 Serverless Contact Center
 
Twilio Signal 2016 Robots-IoT-Watson-Cognitive + Twilio
Twilio Signal 2016 Robots-IoT-Watson-Cognitive + TwilioTwilio Signal 2016 Robots-IoT-Watson-Cognitive + Twilio
Twilio Signal 2016 Robots-IoT-Watson-Cognitive + Twilio
 
Twilio Signal 2016 Leading An Open Hardware Revolution
Twilio Signal 2016 Leading An Open Hardware RevolutionTwilio Signal 2016 Leading An Open Hardware Revolution
Twilio Signal 2016 Leading An Open Hardware Revolution
 
Twilio Signal 2016 IoT Using LittleBits and Twilio SMS
Twilio Signal 2016 IoT Using LittleBits and Twilio SMSTwilio Signal 2016 IoT Using LittleBits and Twilio SMS
Twilio Signal 2016 IoT Using LittleBits and Twilio SMS
 
Twilio Signal 2016 Chaos Patterns
Twilio Signal 2016 Chaos PatternsTwilio Signal 2016 Chaos Patterns
Twilio Signal 2016 Chaos Patterns
 
Twilio Signal 2016 How to Impact Non-profits
Twilio Signal 2016 How to Impact Non-profits Twilio Signal 2016 How to Impact Non-profits
Twilio Signal 2016 How to Impact Non-profits
 
Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Twilio Signal 2016 Bringing P2P to the Masses with WebRTCTwilio Signal 2016 Bringing P2P to the Masses with WebRTC
Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
 
Twilio Signal 2016 Listing Services and Lead Generation
Twilio Signal 2016 Listing Services and Lead GenerationTwilio Signal 2016 Listing Services and Lead Generation
Twilio Signal 2016 Listing Services and Lead Generation
 
Twilio Signal 2016 Bots
Twilio Signal 2016 BotsTwilio Signal 2016 Bots
Twilio Signal 2016 Bots
 
Twilio Signal 2016 Omni-channel Routing Bots
Twilio Signal 2016 Omni-channel Routing BotsTwilio Signal 2016 Omni-channel Routing Bots
Twilio Signal 2016 Omni-channel Routing Bots
 
Twilio Signal 2016 New Documentation
Twilio Signal 2016 New DocumentationTwilio Signal 2016 New Documentation
Twilio Signal 2016 New Documentation
 
Twilio Signal 2016 How to Build Next Generation Speech Analytics
Twilio Signal 2016 How to Build Next Generation Speech AnalyticsTwilio Signal 2016 How to Build Next Generation Speech Analytics
Twilio Signal 2016 How to Build Next Generation Speech Analytics
 
Twilio Signal 2016 Designing Multi-party Call Flows
Twilio Signal 2016 Designing Multi-party Call FlowsTwilio Signal 2016 Designing Multi-party Call Flows
Twilio Signal 2016 Designing Multi-party Call Flows
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

7 Principles of API Design - Waza

  • 1. twilio CLOUD COMMUNICATIONS Designing the Best Telecommunications API Tim Milliron, Director of Engineering @timmilliron
  • 2. Who is twilio? RESTful web APIs to automate Voice & SMS communications Voice SMS Phone Numbers • Inbound • Incoming • PhoneNumber • Outbound • Outgoing Provisioning • Mobile VoIP • Short Codes • ShortCode • Browser VoIP Applications
  • 3. (415) 233-WAZA • Find & buy a number: curl -u $U:$P https://api.twilio.com/2010-04-01/Accounts/AC123/ AvailablePhoneNumbers/US/Local?Contains=415***WAZA curl -u $U:$P -d “PhoneNumber=415233WAZA” https://api.twilio.com/2010-04-01/Accounts/AC123/IncomingPhoneNumbers/ • Make an outgoing call: curl -u $U:$P -d “Url=www.example.com/outgoing.xml” -d “From=4152339292” -d “To=4158675309” https://api.twilio.com/2010-04-01/Accounts/AC123/Calls/ • Receive an incoming call: <Response> <Say>Thanks for calling the Waza Twilio number! Huzzah!</Say> <Sms>Heroku’s Waza Rocks!</Sms> </Response>
  • 5. #1 APIs are for Abstraction Example: DIDs DID  (Direct  Inward  Dial)  —  Inbound-­‐only  phone  number   assigned  to  a  group  of  phone  lines  that  allows  a   phone  system  to  route  to  a  unique  location  or  person.   A  group  of  DIDs  is  often  assigned  to  a  single  trunk   group.  DID  numbers  are  not  sent  out  as  the  ANI  when   the  caller  places  an  outbound  call. Developers don’t give a f*** about DIDs twilio’s API talks PhoneNumbers (they work for incoming & outgoing)
  • 6. #2 What’s the noun? Speak resources: GET api.twilio.com/.../Calls GET api.twilio.com/.../Calls/CA123 POST api.twilio.com/.../Calls Not RPC: GET api.twilio.com/.../GetCalls/ POST api.twilio.com/.../PlaceCall
  • 7. #3 Be RESTful Hypermedia for sub-resource traversal: <Account> <Sid>AC123</Sid> <OwnerAccountSid>AC456</OwnerAccountSid> <FriendlyName>tim@twilio.com's Account</FriendlyName> <Status>active</Status> ... <Uri> /2010-04-01/Accounts/AC123 </Uri> <SubresourceUris> <AvailablePhoneNumbers> /2010-04-01/Accounts/AC123/AvailablePhoneNumbers </AvailablePhoneNumbers> <Calls> /2010-04-01/Accounts/AC123/Calls </Calls> ... </SubresourceUris> </Account>
  • 8. #3 Be RESTful Hypermedia for list traversal: <SMSMessages page="0" numpages="16" pagesize="50" total="780" start="0" end="49" uri="/2010-04-01/Accounts/AC123/SMS/ Messages" firstpageuri="/2010-04-01/Accounts/AC123/SMS/ Messages?Page=0&PageSize=50" previouspageuri="" nextpageuri="/ 2010-04-01/Accounts/AC123/SMS/Messages?Page=1&PageSize=50" lastpageuri="/2010-04-01/Accounts/AC123/SMS/Messages? Page=15&PageSize=50"> ... </SMSMessages>
  • 9. #4 The API Giveth... ... but the API can’t (usually) taketh away It’s much easier to add something than to remove something ➡ Get it in developers’ hands, see what use cases develop. ➡ Then, aggressively add frequently-requested features
  • 10. #5 The Smallest API Possible... twilio.com/ authorize access_token= xxxyyyzzz /Calls?access_token=xxxyyyzzz /IncomingPhoneNumbers?access_token=xxxyyyzzz ...
  • 11. #5 The Smallest API Possible... twilio.com/ authorize account_sid= AC678 /Calls /IncomingPhoneNumbers ...
  • 12. #6 ...But No Smaller “As close to C as possible, but no closer” - Bjarne Stroustrup, creator of C++ Make the common case easy. This works, and it’s generic: curl api.twilio.com/.../AvailablePhoneNumbers? Contains=510******* But, this is what most developers want: curl api.twilio.com/.../AvailablePhoneNumbers? AreaCode=510
  • 13. #7 Don’t Settle • Late changes are OK • Don’t be afraid to version (with good reason) • Get feedback early, often, & throughout Discuss, spec, write, try it, rewrite discuss it some more, rewrite again
  • 14. Process Perspective Discuss Developers Developers Spec Developers Build
  • 15. twilio CLOUD COMMUNICATIONS Tim Milliron, Director of Engineering @timmilliron