SlideShare a Scribd company logo
Craig Ulliott
  likes building things
About me
About me

•   Needs to know how everything works
About me

•   Needs to know how everything works

•   Likes things that scale
About me

•   Needs to know how everything works

•   Likes things that scale

•   Think’s almost everything is inefficient
About me

•   Needs to know how everything works

•   Likes things that scale

•   Think’s almost everything is inefficient

•   Hates people
About me

•   Needs to know how everything works

•   Likes things that scale

•   Think’s almost everything is inefficient

•   Hates people

    •   Just kidding
About me

•   Needs to know how everything works

•   Likes things that scale

•   Think’s almost everything is inefficient

•   Hates people

    •   Just kidding

        •   But people are the cause of all the worlds inefficiencies
About me

•   Needs to know how everything works

•   Likes things that scale

•   Think’s almost everything is inefficient

•   Hates people

    •   Just kidding

        •   But people are the cause of all the worlds inefficiencies


What I do and have done:
Mistakes I’ve Made
Mistakes I’ve Made

Lessons I’ve Learned.
Minimum Viable Product
Minimum Viable Product



• Short sprints (release code regularly)
Minimum Viable Product



• Short sprints (release code regularly)
• Spend an hour thinking about why you’re
  building something, before you spend a
  week thinking about how.
Minimum Viable Product



• Short sprints (release code regularly)
• Spend an hour thinking about why you’re
  building something, before you spend a
  week thinking about how.
• Your developing a business not a website
Surround yourself with business people
Surround yourself with business people



•   If you have a good idea, a strong technical co-
    founder and a business co-founder
    - you will get money / incubated / successful
Surround yourself with business people



•   If you have a good idea, a strong technical co-
    founder and a business co-founder
    - you will get money / incubated / successful

•   I get asked every 3 days if I know any developers
    - why are you guys not meeting each other!
Bootstrap if you can
Bootstrap if you can



•   BUSINESSES that work when they are small are
    easier to scale
Bootstrap if you can



•   BUSINESSES that work when they are small are
    easier to scale

•   The first step to becoming an Entrepreneur is not
    quitting your job
Bootstrap if you can



•   BUSINESSES that work when they are small are
    easier to scale

•   The first step to becoming an Entrepreneur is not
    quitting your job

•   You wont be pragmatic if your worried about
    rent / children / debt / x / y / z
Bootstrap if you can



•   BUSINESSES that work when they are small are
    easier to scale

•   The first step to becoming an Entrepreneur is not
    quitting your job

•   You wont be pragmatic if your worried about
    rent / children / debt / x / y / z

•   Its also a great lesson in finances
Don’t be afraid to share your idea


•   “But someone might steal it.”

•   The hardest thing you will do is going to be getting
    someone genuinely interested in your idea.

•   People that could actually execute your idea are
    too busy with their own ideas.

•   It’s a lot cheaper for someone to take a bet (put all
    the risk) on you, than try and do it themselves.
Fail quickly and fail often
Fail quickly and fail often

one in seven businesses make it...
Fail quickly and fail often

one in seven businesses make it...
               ...so start seven businesses!
WIB APIs in 2009
Some problem’s

•   WIB was completely dependent on lots of
    different social networks

    •   They break and change stuff

    •   Our code becomes complicated (entropy)

•   WIB had a small team

    •   And lots of stuff to do

•   WIB had a lot of members

    •   half a billion db rows & 7000+ queries a second
What is abstraction
a web application is like an onion
The Solution:
       “Network Abstraction Layer”


•   Wrapped Facebook, Myspace, Bebo, Hi5,
    Friendster and Orkut

•   Normalized the I/O

•   Absorbed changes where they happen

•   Handled breakages

•   Data sharing across the whole network
    - Facebook user can see a MySpace user
and it’s really extensible




• We can add functionality and data without
  breaking the other networks
• We can add other networks very easily
It’s also nice and scalable (for a team)



• An API has a defined protocol, so
  developers on our team could work side by
  side on the different networks.
• As long as I/O stays the same, they can
  work independently
And it scales well technically



• Dividing an application into layers makes it
  much easier to scale.
• Mainly because the independent layers can
  be scaled (or re-written) independently,
  without breaking other components.
WIB APIs in 2011
WIB APIs in 2011
WIB Today

                           Where I’ve Been . com



                                             The website does not
                                            connect directly to the
                                                  database
 Facebook

  Twitter
                           WIB oAuth 2 REST API
Foursquare

And others...
                Database         Database          Database
Advantages of a single API


•   Saves Time (money) and it’s Extensible (future proof)


•   Teams can work on their own platforms

    •   Website, iPhone, Android, Facebook App et.al.


•   Federate out content (or build developer network)
How to build an API
(an opinionated approach)
how to build stuff in general
how to build stuff in general



• Developers cost
how to build stuff in general



• Developers cost


• Servers cost
Use Ruby on Rails
Use Ruby on Rails

• It allows you to build reliable, powerful,
  readable code
Use Ruby on Rails

• It allows you to build reliable, powerful,
  readable code
• With RoR you can build a business in a
  week and host it for free
Use Ruby on Rails

• It allows you to build reliable, powerful,
  readable code
• With RoR you can build a business in a
  week and host it for free




               Even monkeys use tools!
Why Ruby on Rails is good for an API
Why Ruby on Rails is good for an API
        Especially if you’re a startup
Why Ruby on Rails is good for an API
              Especially if you’re a startup

•   RESTful out of the box
Why Ruby on Rails is good for an API
              Especially if you’re a startup

•   RESTful out of the box

•   Normalized data
Why Ruby on Rails is good for an API
               Especially if you’re a startup

•   RESTful out of the box

•   Normalized data

    •   Encourages powerful abstraction
Why Ruby on Rails is good for an API
               Especially if you’re a startup

•   RESTful out of the box

•   Normalized data

    •   Encourages powerful abstraction

•   It’s easy and quick to develop
Why Ruby on Rails is good for an API
               Especially if you’re a startup

•   RESTful out of the box

•   Normalized data

    •   Encourages powerful abstraction

•   It’s easy and quick to develop

•   Its easy to write tests
Why Ruby on Rails is good for an API
               Especially if you’re a startup

•   RESTful out of the box

•   Normalized data

    •   Encourages powerful abstraction

•   It’s easy and quick to develop

•   Its easy to write tests

•   Scales horizontally (until you’ve already “made it”)
    - the bottleneck will be your DB
RESTful web service


•   REST is how the web already works
    (makes it a pretty well known standard)

•   URL’s are self explanatory (easy to work with)

•   Closely matches the underlying data/objects

    •   Makes it easy to build in a DRY way

    •   Developers can get started very quickly
HTTP methods



•   POST : Create something new

•   GET : Retrieve something that already exists

•   PUT : Update something that already exists

•   DELETE : Remove something that already exists
Authorization and Authentication



• Authentication
 • Who is this
• Authorization
 • Can the Authenticated entity access this
    resource
oAuth1 vs oAuth2


• oAuth 2 is slightly less secure
• But it makes everyone’s lives SO much
  easier
• Build a “trusted” clients paradigm for
  internal use
  - login, register, reset password etc
HTTP Request

       Authentication
                                   Web server



                                   Framework




                                  Authentication
It makes things really easy for
         developers
                                  Authorization
lots of libraries and examples
              exist

                                  API Controller
Access Tokens

•   Different tokens for user+client and client


•   Store useful info in them, allows you to
    calculate on the fly instead of store in the db



        c1234-g7rCEVB867rbe4B-1234567
Access Tokens

•   Different tokens for user+client and client


•   Store useful info in them, allows you to
    calculate on the fly instead of store in the db



        c1234-g7rCEVB867rbe4B-1234567

        client_id = 12345
Access Tokens

•   Different tokens for user+client and client


•   Store useful info in them, allows you to
    calculate on the fly instead of store in the db



        c1234-g7rCEVB867rbe4B-1234567

                                   user_id = 1234576
Access Tokens

•   Different tokens for user+client and client


•   Store useful info in them, allows you to
    calculate on the fly instead of store in the db



        c1234-g7rCEVB867rbe4B-1234567

                  hash(client_secret+user_id)
Access Tokens

•   Different tokens for user+client and client


•   Store useful info in them, allows you to
    calculate on the fly instead of store in the db



        c1234-g7rCEVB867rbe4B-1234567
SSL


iPhone
           WiFi    laptop running squid           internet




 •   Require it, otherwise developers will expose all
     sort of stuff (like keys)

 •   Important if you want to be taken seriously by
     developer community
SSL


iPhone
           WiFi     laptop running squid           internet


               looking at all the traffic is easy



 •   Require it, otherwise developers will expose all
     sort of stuff (like keys)

 •   Important if you want to be taken seriously by
     developer community
Standardized Errors


• Assume success=true
• Always send back errors in the same way,
  so client libraries can be smart

    {
        "error": {
           "type": "ObjectException",
           "message": "Object does not exist"
        }
    }
Limit how much data gets send back

• Mobile developers care a lot about this
• allow customizations:
  fields=name,gender
DRY Definitions
HTTP Request
                           Logging

Errors:                                                  Web server
  •       GetExceptional
          $20 a month (whats your time worth?)

Performance:                                             Framework
  •       New Relic

API Requests

  •       Something simple near the top of your stack      Logging
          (remember, storage is cheap)



                                                        API Controller
GetExceptional
GetExceptional - Backtraces
New Relic
New Relic
Roll your own
Roll your own
JSON



•   It’s smaller than XML

•   Developers write bad xml parsers, that rely on the
    order of the XML nodes

•   Facebook use it, and they set the standard
    - you want your API to be sexy don’t you?
Returning Data

• Standarized
  - objects
  - arrays of objects
  - nested objects
Standardize object output
DRY Documentation never goes out of date




• Build it off the
  - models
  - connections
  - methods
Testing



• Write tests on your API
 • Even if you hate tests
   • It’s easy
    • You can generate most of them just
       like the documentation
Tie it all together


•   A good API is a series of simple layers

•   Keep it DRY

    •   Use the data structure for more dynamic code

•   Standards are your friend

•   There are plenty of examples out there
    - Facebook, Foursquare, Twitter etc
Thanks




• Hope this was useful

More Related Content

KEY
Becoming a more productive Rails Developer
John McCaffrey
 
KEY
Irb Tips and Tricks
John McCaffrey
 
KEY
LeanStartup:Research is cheaper than development
John McCaffrey
 
PDF
Rapid Evolution of Web Dev? aka Talking About The Web
PINT Inc
 
KEY
Less 'Oh Shit' With GIT
Richard Tape
 
KEY
Big Websites
Four Kitchens
 
PPTX
Untangling spring week3
Derek Jacoby
 
PPT
Customizing the custom loop wordcamp 2012
Alexander Sapountzis
 
Becoming a more productive Rails Developer
John McCaffrey
 
Irb Tips and Tricks
John McCaffrey
 
LeanStartup:Research is cheaper than development
John McCaffrey
 
Rapid Evolution of Web Dev? aka Talking About The Web
PINT Inc
 
Less 'Oh Shit' With GIT
Richard Tape
 
Big Websites
Four Kitchens
 
Untangling spring week3
Derek Jacoby
 
Customizing the custom loop wordcamp 2012
Alexander Sapountzis
 

What's hot (20)

PPTX
Untangling the web week 2 - SEO
Derek Jacoby
 
PDF
Funtional Ruby - Mikhail Bortnyk
Ruby Meditation
 
PDF
Triple your blog post frequency
Andraz Tori
 
PPTX
Achieving Beautiful Typography in eBooks
digitalbindery
 
PDF
Surviving a Hackathon and Beyond
imoneytech
 
KEY
MWUG wp-myths
Mike Little
 
PPTX
Untangling spring week2
Derek Jacoby
 
PDF
Html5 web sockets - Brad Drysdale - London Web 2011-10-20
Nathan O'Hanlon
 
KEY
Write a better FM
Rich Bowen
 
KEY
Killer Docs for Killer Devs
spmckeown
 
PDF
Triple Your Post Frequency
Zemanta
 
PPTX
WordPress Rest API
Brian Layman
 
PDF
11 Amazing things I Learnt At Word Camp Sydney 2014
WordPressBrisbane
 
KEY
Blogging
Chelle Yarbrough
 
PDF
CPL12-Agile-planning
Amir Barylko
 
KEY
Write A Better FM - Ohio Linux 2011
Rich Bowen
 
PPTX
How to Increase Community Online
Nathan O'Hanlon
 
PPT
Rethinking Scala Presented in San Francisco May 7, 2014
Bruce Eckel
 
PDF
SEO Horror Stories
pointit
 
PDF
Using HipChat For Real Time Communication in Social Media - Thad West
Atlassian
 
Untangling the web week 2 - SEO
Derek Jacoby
 
Funtional Ruby - Mikhail Bortnyk
Ruby Meditation
 
Triple your blog post frequency
Andraz Tori
 
Achieving Beautiful Typography in eBooks
digitalbindery
 
Surviving a Hackathon and Beyond
imoneytech
 
MWUG wp-myths
Mike Little
 
Untangling spring week2
Derek Jacoby
 
Html5 web sockets - Brad Drysdale - London Web 2011-10-20
Nathan O'Hanlon
 
Write a better FM
Rich Bowen
 
Killer Docs for Killer Devs
spmckeown
 
Triple Your Post Frequency
Zemanta
 
WordPress Rest API
Brian Layman
 
11 Amazing things I Learnt At Word Camp Sydney 2014
WordPressBrisbane
 
CPL12-Agile-planning
Amir Barylko
 
Write A Better FM - Ohio Linux 2011
Rich Bowen
 
How to Increase Community Online
Nathan O'Hanlon
 
Rethinking Scala Presented in San Francisco May 7, 2014
Bruce Eckel
 
SEO Horror Stories
pointit
 
Using HipChat For Real Time Communication in Social Media - Thad West
Atlassian
 
Ad

Viewers also liked (9)

PPTX
Technology Instuction
cynthia5000
 
PPS
Art Of Liu Mao Shan現代感的國畫
yu3495
 
PPTX
Blaireail
jpurdy
 
PPT
Henryail
jpurdy
 
PPS
The Farmers Robert Duncan Ari
katehsieh
 
PPT
Mirandanet Seminar 22nd September 2009
guest7c46c5b
 
PPTX
Integrating Tech Ppt
cynthia5000
 
PPT
Skateboardingail
jpurdy
 
ODP
Presentation made at Devoxx'09
Usi4Biz
 
Technology Instuction
cynthia5000
 
Art Of Liu Mao Shan現代感的國畫
yu3495
 
Blaireail
jpurdy
 
Henryail
jpurdy
 
The Farmers Robert Duncan Ari
katehsieh
 
Mirandanet Seminar 22nd September 2009
guest7c46c5b
 
Integrating Tech Ppt
cynthia5000
 
Skateboardingail
jpurdy
 
Presentation made at Devoxx'09
Usi4Biz
 
Ad

Similar to Social dev camp_2011 (20)

PDF
Designing your API Server for mobile apps
Mugunth Kumar
 
PDF
Designing Web Apis Building Apis That Developers Love Jin Brendasahni
reknesluima
 
KEY
API Best Practices
Andreas Krohn
 
PPT
API Management and Community Development layer 7 in london 2012
James Governor
 
PDF
Code for Startup MVP (Ruby on Rails) Session 1
Henry S
 
PDF
The Developers World
Ronald Northrip
 
PDF
Applicaton Development using RESTful APIs
Sourav Maji
 
PDF
Be My API How to Implement an API Strategy Everyone will Love
CA API Management
 
PDF
Web APIs: The future of software
Reuven Lerner
 
PDF
api-driven-development.pdf
DivyanshGupta922023
 
PDF
What is REST?
Saeid Zebardast
 
PPTX
Building a REST API for Longevity
MuleSoft
 
PDF
Api Design Patterns Meap V07 Meap V07 Jj Geewax
mohellrakes
 
PDF
Django in the Real World
Jacob Kaplan-Moss
 
PDF
Consumer centric api design v0.4.0
mustafa sarac
 
PPTX
Php rules
christopher mabunda
 
PPT
Ro R(2)
tomcoh
 
PDF
Product! - The road to production deployment
Filippo Zanella
 
PPTX
API economy
vty
 
PDF
APIs: The Building Blocks of the Future
BBDO
 
Designing your API Server for mobile apps
Mugunth Kumar
 
Designing Web Apis Building Apis That Developers Love Jin Brendasahni
reknesluima
 
API Best Practices
Andreas Krohn
 
API Management and Community Development layer 7 in london 2012
James Governor
 
Code for Startup MVP (Ruby on Rails) Session 1
Henry S
 
The Developers World
Ronald Northrip
 
Applicaton Development using RESTful APIs
Sourav Maji
 
Be My API How to Implement an API Strategy Everyone will Love
CA API Management
 
Web APIs: The future of software
Reuven Lerner
 
api-driven-development.pdf
DivyanshGupta922023
 
What is REST?
Saeid Zebardast
 
Building a REST API for Longevity
MuleSoft
 
Api Design Patterns Meap V07 Meap V07 Jj Geewax
mohellrakes
 
Django in the Real World
Jacob Kaplan-Moss
 
Consumer centric api design v0.4.0
mustafa sarac
 
Ro R(2)
tomcoh
 
Product! - The road to production deployment
Filippo Zanella
 
API economy
vty
 
APIs: The Building Blocks of the Future
BBDO
 

Recently uploaded (20)

PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Doc9.....................................
SofiaCollazos
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 

Social dev camp_2011

  • 1. Craig Ulliott likes building things
  • 3. About me • Needs to know how everything works
  • 4. About me • Needs to know how everything works • Likes things that scale
  • 5. About me • Needs to know how everything works • Likes things that scale • Think’s almost everything is inefficient
  • 6. About me • Needs to know how everything works • Likes things that scale • Think’s almost everything is inefficient • Hates people
  • 7. About me • Needs to know how everything works • Likes things that scale • Think’s almost everything is inefficient • Hates people • Just kidding
  • 8. About me • Needs to know how everything works • Likes things that scale • Think’s almost everything is inefficient • Hates people • Just kidding • But people are the cause of all the worlds inefficiencies
  • 9. About me • Needs to know how everything works • Likes things that scale • Think’s almost everything is inefficient • Hates people • Just kidding • But people are the cause of all the worlds inefficiencies What I do and have done:
  • 11. Mistakes I’ve Made Lessons I’ve Learned.
  • 13. Minimum Viable Product • Short sprints (release code regularly)
  • 14. Minimum Viable Product • Short sprints (release code regularly) • Spend an hour thinking about why you’re building something, before you spend a week thinking about how.
  • 15. Minimum Viable Product • Short sprints (release code regularly) • Spend an hour thinking about why you’re building something, before you spend a week thinking about how. • Your developing a business not a website
  • 16. Surround yourself with business people
  • 17. Surround yourself with business people • If you have a good idea, a strong technical co- founder and a business co-founder - you will get money / incubated / successful
  • 18. Surround yourself with business people • If you have a good idea, a strong technical co- founder and a business co-founder - you will get money / incubated / successful • I get asked every 3 days if I know any developers - why are you guys not meeting each other!
  • 20. Bootstrap if you can • BUSINESSES that work when they are small are easier to scale
  • 21. Bootstrap if you can • BUSINESSES that work when they are small are easier to scale • The first step to becoming an Entrepreneur is not quitting your job
  • 22. Bootstrap if you can • BUSINESSES that work when they are small are easier to scale • The first step to becoming an Entrepreneur is not quitting your job • You wont be pragmatic if your worried about rent / children / debt / x / y / z
  • 23. Bootstrap if you can • BUSINESSES that work when they are small are easier to scale • The first step to becoming an Entrepreneur is not quitting your job • You wont be pragmatic if your worried about rent / children / debt / x / y / z • Its also a great lesson in finances
  • 24. Don’t be afraid to share your idea • “But someone might steal it.” • The hardest thing you will do is going to be getting someone genuinely interested in your idea. • People that could actually execute your idea are too busy with their own ideas. • It’s a lot cheaper for someone to take a bet (put all the risk) on you, than try and do it themselves.
  • 25. Fail quickly and fail often
  • 26. Fail quickly and fail often one in seven businesses make it...
  • 27. Fail quickly and fail often one in seven businesses make it... ...so start seven businesses!
  • 28. WIB APIs in 2009
  • 29. Some problem’s • WIB was completely dependent on lots of different social networks • They break and change stuff • Our code becomes complicated (entropy) • WIB had a small team • And lots of stuff to do • WIB had a lot of members • half a billion db rows & 7000+ queries a second
  • 30. What is abstraction a web application is like an onion
  • 31. The Solution: “Network Abstraction Layer” • Wrapped Facebook, Myspace, Bebo, Hi5, Friendster and Orkut • Normalized the I/O • Absorbed changes where they happen • Handled breakages • Data sharing across the whole network - Facebook user can see a MySpace user
  • 32. and it’s really extensible • We can add functionality and data without breaking the other networks • We can add other networks very easily
  • 33. It’s also nice and scalable (for a team) • An API has a defined protocol, so developers on our team could work side by side on the different networks. • As long as I/O stays the same, they can work independently
  • 34. And it scales well technically • Dividing an application into layers makes it much easier to scale. • Mainly because the independent layers can be scaled (or re-written) independently, without breaking other components.
  • 35. WIB APIs in 2011
  • 36. WIB APIs in 2011
  • 37. WIB Today Where I’ve Been . com The website does not connect directly to the database Facebook Twitter WIB oAuth 2 REST API Foursquare And others... Database Database Database
  • 38. Advantages of a single API • Saves Time (money) and it’s Extensible (future proof) • Teams can work on their own platforms • Website, iPhone, Android, Facebook App et.al. • Federate out content (or build developer network)
  • 39. How to build an API (an opinionated approach)
  • 40. how to build stuff in general
  • 41. how to build stuff in general • Developers cost
  • 42. how to build stuff in general • Developers cost • Servers cost
  • 43. Use Ruby on Rails
  • 44. Use Ruby on Rails • It allows you to build reliable, powerful, readable code
  • 45. Use Ruby on Rails • It allows you to build reliable, powerful, readable code • With RoR you can build a business in a week and host it for free
  • 46. Use Ruby on Rails • It allows you to build reliable, powerful, readable code • With RoR you can build a business in a week and host it for free Even monkeys use tools!
  • 47. Why Ruby on Rails is good for an API
  • 48. Why Ruby on Rails is good for an API Especially if you’re a startup
  • 49. Why Ruby on Rails is good for an API Especially if you’re a startup • RESTful out of the box
  • 50. Why Ruby on Rails is good for an API Especially if you’re a startup • RESTful out of the box • Normalized data
  • 51. Why Ruby on Rails is good for an API Especially if you’re a startup • RESTful out of the box • Normalized data • Encourages powerful abstraction
  • 52. Why Ruby on Rails is good for an API Especially if you’re a startup • RESTful out of the box • Normalized data • Encourages powerful abstraction • It’s easy and quick to develop
  • 53. Why Ruby on Rails is good for an API Especially if you’re a startup • RESTful out of the box • Normalized data • Encourages powerful abstraction • It’s easy and quick to develop • Its easy to write tests
  • 54. Why Ruby on Rails is good for an API Especially if you’re a startup • RESTful out of the box • Normalized data • Encourages powerful abstraction • It’s easy and quick to develop • Its easy to write tests • Scales horizontally (until you’ve already “made it”) - the bottleneck will be your DB
  • 55. RESTful web service • REST is how the web already works (makes it a pretty well known standard) • URL’s are self explanatory (easy to work with) • Closely matches the underlying data/objects • Makes it easy to build in a DRY way • Developers can get started very quickly
  • 56. HTTP methods • POST : Create something new • GET : Retrieve something that already exists • PUT : Update something that already exists • DELETE : Remove something that already exists
  • 57. Authorization and Authentication • Authentication • Who is this • Authorization • Can the Authenticated entity access this resource
  • 58. oAuth1 vs oAuth2 • oAuth 2 is slightly less secure • But it makes everyone’s lives SO much easier • Build a “trusted” clients paradigm for internal use - login, register, reset password etc
  • 59. HTTP Request Authentication Web server Framework Authentication It makes things really easy for developers Authorization lots of libraries and examples exist API Controller
  • 60. Access Tokens • Different tokens for user+client and client • Store useful info in them, allows you to calculate on the fly instead of store in the db c1234-g7rCEVB867rbe4B-1234567
  • 61. Access Tokens • Different tokens for user+client and client • Store useful info in them, allows you to calculate on the fly instead of store in the db c1234-g7rCEVB867rbe4B-1234567 client_id = 12345
  • 62. Access Tokens • Different tokens for user+client and client • Store useful info in them, allows you to calculate on the fly instead of store in the db c1234-g7rCEVB867rbe4B-1234567 user_id = 1234576
  • 63. Access Tokens • Different tokens for user+client and client • Store useful info in them, allows you to calculate on the fly instead of store in the db c1234-g7rCEVB867rbe4B-1234567 hash(client_secret+user_id)
  • 64. Access Tokens • Different tokens for user+client and client • Store useful info in them, allows you to calculate on the fly instead of store in the db c1234-g7rCEVB867rbe4B-1234567
  • 65. SSL iPhone WiFi laptop running squid internet • Require it, otherwise developers will expose all sort of stuff (like keys) • Important if you want to be taken seriously by developer community
  • 66. SSL iPhone WiFi laptop running squid internet looking at all the traffic is easy • Require it, otherwise developers will expose all sort of stuff (like keys) • Important if you want to be taken seriously by developer community
  • 67. Standardized Errors • Assume success=true • Always send back errors in the same way, so client libraries can be smart { "error": { "type": "ObjectException", "message": "Object does not exist" } }
  • 68. Limit how much data gets send back • Mobile developers care a lot about this • allow customizations: fields=name,gender
  • 70. HTTP Request Logging Errors: Web server • GetExceptional $20 a month (whats your time worth?) Performance: Framework • New Relic API Requests • Something simple near the top of your stack Logging (remember, storage is cheap) API Controller
  • 77. JSON • It’s smaller than XML • Developers write bad xml parsers, that rely on the order of the XML nodes • Facebook use it, and they set the standard - you want your API to be sexy don’t you?
  • 78. Returning Data • Standarized - objects - arrays of objects - nested objects
  • 80. DRY Documentation never goes out of date • Build it off the - models - connections - methods
  • 81. Testing • Write tests on your API • Even if you hate tests • It’s easy • You can generate most of them just like the documentation
  • 82. Tie it all together • A good API is a series of simple layers • Keep it DRY • Use the data structure for more dynamic code • Standards are your friend • There are plenty of examples out there - Facebook, Foursquare, Twitter etc
  • 83. Thanks • Hope this was useful

Editor's Notes