SlideShare a Scribd company logo
API Driven Development
Kenneth Reitz
How I Develop Things and Why.
Hi.
@kennethreitz
api-driven-development.pdf
Open Source
Requests
HTTP for Humans
Httpbin.org
$ curl http://httpbin.org/get?test=1
{
"url": "http://httpbin.org/get",
"headers": {
"Content-Length": "",
"Connection": "keep-alive",
"Accept": "*/*",
"User-Agent": "curl/7.21.4 ...",
"Host": "httpbin.org",
"Content-Type": ""
},
"args": {
“test”: “1”
},
"origin": "67.163.102.42"
}
Et Cetera
• Legit: Git Workflow for Humans
• Envoy: Subprocess for Humans
• Tablib: Tabular Data for Humans
• Clint: CLI App Toolkit
• Autoenv: Magic Shell Environments
• OSX-GCC-Installer: Provokes Lawyers
275+ More
Purpose
We’re Diverse.
• Product guys: non-tech
cofounders
• Sales guys: hustlers
• Marketers: spammers
• Designers: pixel pushers
• Developers: code monkeys
We come from many backgrounds.
What do we have
in common?
We’re Makers.
• Product guys: visionaries
• Sales guys: sustainability
• Marketers: communication
• Designers: experience and
philosophy
• Developers: make the magic
We craft experiences & interfaces.
Developers!
Developers, Developers,
Developers.
— Steve Jobs, 1983
People are going to be
spending two or three hours a
day
with these machines — more
than they spend with a car.
— Steve Jobs, 1983
Software design must be given
at least as much consideration
as we give automobiles today
— if not a lot more.
That worked.
Beautiful Interfaces.
• Industrial Design
• Web Interfaces
• iOS, Android, Mobile Apps
• Desktop Clients & Applications
Today, beautiful applications abound.
Hackers are
the real Makers.
Developers spend 8+ hours a
day with APIs.
Why are they treated differently?
Web Application
Management
Tools
Supporting Services
Tools & Utilities Web Process Worker Process
Scheduled Tasks
Deferred Tasks
API Service
CRUD Admin
Data Persistence
User Interface
Authentication
API Service
End Users
API Service
Internal
API Service
Developers
( )
Data Persistence
Message Queue Workers
Everything is a remix*.
* APIs Rule Everything Around Us.
How?
Step I: Have an
A Real, Tangible
Problem.
You can't solve a problem properly if
you don't experience it firsthand.
Example: OneNote.
• Hierarchical, freeform note-taking
software that assumes nothing.
• Only available on Windows.
• I want to make OneNote for OS
X.
• It would be incredible.
The finest note-taking platform on earth.
GitHub Success
• GitHub wasn't built for the developer
community at large.
• Resonated with millions of
developers.
• They themselves happen to be
developers.
Over two million people collaborating.
Other’s Success
• Gumroad, built for the founder.
• 37 Signals product, build for the
team.
• Ruby on Rails, by Rubyists for
Rubyists.
Optimization
• Feature driven development?
• Profit driven development?
• Growth driven development?
• Problem driven development.
What drives your decisions?
pra•gmat•ic |pragˈmatik|, adj:
Dealing with things sensibly and
realistically in a way that is based on
practical rather than theoretical
considerations
We know Ruby...
require 'net/http'
require 'uri'
uri = URI.parse('https://api.github.com/user')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri.request_uri)
req.basic_auth('username', 'password')
r = http.request(req)
puts r
import urllib2
gh_url = 'https://api.github.com/user'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_manager.add_password(None, gh_url, 'user', 'pass')
auth_manager = urllib2.HTTPBasicAuthHandler(password_manager)
opener = urllib2.build_opener(auth_manager)
urllib2.install_opener(opener)
handler = urllib2.urlopen(req)
print handler.read()
import re
class HTTPForcedBasicAuthHandler(HTTPBasicAuthHandler):
auth_header = 'Authorization'
rx = re.compile('(?:.*,)*[ t]*([^ t]+)[ t]+'
'realm=(["'])(.*?)2', re.I)
def __init__(self, *args, **kwargs):
HTTPBasicAuthHandler.__init__(self, *args, **kwargs)
def http_error_401(self, req, fp, code, msg, headers):
url = req.get_full_url()
response = self._http_error_auth_reqed(
'www-authenticate', url, req, headers)
self.reset_retry_count()
return response
Admit it.
You’d leave and never come
back.
This is a serious
problem.
HTTP should be as
simple as a print
statement.
APIs For Humans
Let’s Break it Down.
• A small set of methods with
consistent parameters.
• HEAD, GET, POST, PUSH,
PUT, PATCH, DELETE, &c.
• They all accept Headers, URL
Parameters, Body/Form Data.
What is HTTP at its core?
Enter Requests.
HTTP for Humans.
import requests
url = 'https://api.github.com/user'
auth = ('username', 'password')
r = requests.get(url, auth=auth)
print r.content
api-driven-development.pdf
Achievement
Unlocked!
• A small set of methods with
consistent parameters.
• HEAD, GET, POST, PUSH,
PUT, PATCH, DELETE, &c.
• They all accept Headers, URL
Parameters, Body/Form Data.
Requests Success
• Python is a language built for
Humans.
• Why should HTTP be non-trivial?
• I explored and discovered what I
really needed, and built it.
• I had a real problem that I solved for
myself.
Requests Success
• At first, Requests was far from
powerful.
• But, it deeply resonated with
people.
• Features grew over time, but the
API was never compromised.
• Quite popular.
Developers spend 8+ hours a
day with APIs.
Build for yourself—a developer.
Step II: Respond.
Write the README.
• Before any code is written,
write the README — show
some examples.
• Write some code with the
theoretical code that you’ve
documented.
Achievement
Unlocked!
• Instead of engineering something to
get the job done, you interact with
the problem itself and build an
interface that reacts to it.
• You discover it. You respond to it.
• Great sculptures aren’t
engineered or manufactured—
they’re discovered.
• The sculptor studies and listens
to the marble. He identifies with
it.
• Then, he responds.
• Setting free something hidden
Sculptures, Etc.
• It’s not about a design that will
“work” on a phone, tablet, and
desktop.
• It’s about making something that
identifies itself enough to respond
to the environment it’s placed in.
• Free of arbitrary constraints.
Responsive Design
Readme-Driven Development?
Responsive API Design.
Step III: Build.
• Once you discover the API: build
it.
• Write all the code necessary to
make exactly what you
documented happen.
• Complex code? Layer your API.
• “Porcelain” layer is documented.
Responsive Design
The API is all that matters.
Everything else is secondary.
Do unto others as you would
have them do to you?
Build tools for others that you
want to be built for you.
Pro Tips™
CONSTRA
INTS
FOST
ER
CREATI
Open Source
All The Things!
Build for Open
Source
• Components become concise &
decoupled.
• Concerns separate themselves.
• Best practices emerge (e.g. no creds in
code).
• Documentation and tests become
crucial.
Build for Open
Source
• Components become concise &
decoupled.
• Concerns separate themselves.
• Best practices emerge (e.g. no creds in
code).
• Documentation and tests become
crucial.
Build for Services
• Components become concise &
decoupled.
• Concerns separate themselves.
• Best practices emerge (e.g. ideal tools).
• Documentation and contracts become
crucial.
• Services can be scaled separately at
— Pieter Hintjens
Simplicity is always
better than functionality.
github.com/kennethreitz
Questions?
Ad

More Related Content

Similar to api-driven-development.pdf (20)

UI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware ProjectsUI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware Projects
pchristensen
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
Avi Kedar
 
OWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript ApplicationsOWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript Applications
Lewis Ardern
 
Dev ops lessons learned - Michael Collins
Dev ops lessons learned  - Michael CollinsDev ops lessons learned  - Michael Collins
Dev ops lessons learned - Michael Collins
Devopsdays
 
Future of Development and Deployment using Docker
Future of Development and Deployment using DockerFuture of Development and Deployment using Docker
Future of Development and Deployment using Docker
Tamer Abdul-Radi
 
Philly CocoaHeads 20160414 - Building Your App SDK With Swift
Philly CocoaHeads 20160414 - Building Your App SDK With SwiftPhilly CocoaHeads 20160414 - Building Your App SDK With Swift
Philly CocoaHeads 20160414 - Building Your App SDK With Swift
Jordan Yaker
 
API Design Workflows
API Design WorkflowsAPI Design Workflows
API Design Workflows
Jakub Nesetril
 
Coderbuddy
CoderbuddyCoderbuddy
Coderbuddy
500 Startups
 
Programming the Real World: Javascript for Makers
Programming the Real World: Javascript for MakersProgramming the Real World: Javascript for Makers
Programming the Real World: Javascript for Makers
pchristensen
 
Developing applications with Hyperledger Fabric SDK
Developing applications with Hyperledger Fabric SDKDeveloping applications with Hyperledger Fabric SDK
Developing applications with Hyperledger Fabric SDK
Horea Porutiu
 
Mobeers waterloo-2011
Mobeers waterloo-2011Mobeers waterloo-2011
Mobeers waterloo-2011
Brian LeRoux
 
Wondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free DownloadWondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free Download
anglekaan18
 
2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf
2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf
2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf
Shereef
 
AOMEI Backupper Crack 2025 FREE Download
AOMEI Backupper Crack 2025 FREE DownloadAOMEI Backupper Crack 2025 FREE Download
AOMEI Backupper Crack 2025 FREE Download
muhammadwaqaryounus6
 
Wondershare PDFelement Pro Crack FREE Download
Wondershare PDFelement Pro Crack FREE DownloadWondershare PDFelement Pro Crack FREE Download
Wondershare PDFelement Pro Crack FREE Download
waqarcracker5
 
The hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignmentsThe hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignments
n|u - The Open Security Community
 
Building RESTful APIs
Building RESTful APIsBuilding RESTful APIs
Building RESTful APIs
Silota Inc.
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
DevelopmentArc LLC
 
Real time web
Real time webReal time web
Real time web
Medhat Dawoud
 
Tech Thursdays: Building Products
Tech Thursdays: Building ProductsTech Thursdays: Building Products
Tech Thursdays: Building Products
Hayden Bleasel
 
UI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware ProjectsUI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware Projects
pchristensen
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
Avi Kedar
 
OWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript ApplicationsOWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript Applications
Lewis Ardern
 
Dev ops lessons learned - Michael Collins
Dev ops lessons learned  - Michael CollinsDev ops lessons learned  - Michael Collins
Dev ops lessons learned - Michael Collins
Devopsdays
 
Future of Development and Deployment using Docker
Future of Development and Deployment using DockerFuture of Development and Deployment using Docker
Future of Development and Deployment using Docker
Tamer Abdul-Radi
 
Philly CocoaHeads 20160414 - Building Your App SDK With Swift
Philly CocoaHeads 20160414 - Building Your App SDK With SwiftPhilly CocoaHeads 20160414 - Building Your App SDK With Swift
Philly CocoaHeads 20160414 - Building Your App SDK With Swift
Jordan Yaker
 
Programming the Real World: Javascript for Makers
Programming the Real World: Javascript for MakersProgramming the Real World: Javascript for Makers
Programming the Real World: Javascript for Makers
pchristensen
 
Developing applications with Hyperledger Fabric SDK
Developing applications with Hyperledger Fabric SDKDeveloping applications with Hyperledger Fabric SDK
Developing applications with Hyperledger Fabric SDK
Horea Porutiu
 
Mobeers waterloo-2011
Mobeers waterloo-2011Mobeers waterloo-2011
Mobeers waterloo-2011
Brian LeRoux
 
Wondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free DownloadWondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free Download
anglekaan18
 
2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf
2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf
2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf
Shereef
 
AOMEI Backupper Crack 2025 FREE Download
AOMEI Backupper Crack 2025 FREE DownloadAOMEI Backupper Crack 2025 FREE Download
AOMEI Backupper Crack 2025 FREE Download
muhammadwaqaryounus6
 
Wondershare PDFelement Pro Crack FREE Download
Wondershare PDFelement Pro Crack FREE DownloadWondershare PDFelement Pro Crack FREE Download
Wondershare PDFelement Pro Crack FREE Download
waqarcracker5
 
The hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignmentsThe hardcore stuff i hack, experiences from past VAPT assignments
The hardcore stuff i hack, experiences from past VAPT assignments
n|u - The Open Security Community
 
Building RESTful APIs
Building RESTful APIsBuilding RESTful APIs
Building RESTful APIs
Silota Inc.
 
Tech Thursdays: Building Products
Tech Thursdays: Building ProductsTech Thursdays: Building Products
Tech Thursdays: Building Products
Hayden Bleasel
 

More from DivyanshGupta922023 (19)

Git mercurial - Git basics , features and commands
Git mercurial - Git basics , features and commandsGit mercurial - Git basics , features and commands
Git mercurial - Git basics , features and commands
DivyanshGupta922023
 
Fundamentals and basics of Git and commands
Fundamentals and basics of Git and commandsFundamentals and basics of Git and commands
Fundamentals and basics of Git and commands
DivyanshGupta922023
 
(Public) FedCM BlinkOn 16 fedcm and privacy sandbox apis
(Public) FedCM BlinkOn 16 fedcm and privacy sandbox apis(Public) FedCM BlinkOn 16 fedcm and privacy sandbox apis
(Public) FedCM BlinkOn 16 fedcm and privacy sandbox apis
DivyanshGupta922023
 
DevOps The Buzzword - everything about devops
DevOps The Buzzword - everything about devopsDevOps The Buzzword - everything about devops
DevOps The Buzzword - everything about devops
DivyanshGupta922023
 
Git Basics walkthough to all basic concept and commands of git
Git Basics walkthough to all basic concept and commands of gitGit Basics walkthough to all basic concept and commands of git
Git Basics walkthough to all basic concept and commands of git
DivyanshGupta922023
 
jquery summit presentation for large scale javascript applications
jquery summit  presentation for large scale javascript applicationsjquery summit  presentation for large scale javascript applications
jquery summit presentation for large scale javascript applications
DivyanshGupta922023
 
Next.js - ReactPlayIO.pptx
Next.js - ReactPlayIO.pptxNext.js - ReactPlayIO.pptx
Next.js - ReactPlayIO.pptx
DivyanshGupta922023
 
Management+team.pptx
Management+team.pptxManagement+team.pptx
Management+team.pptx
DivyanshGupta922023
 
DHC Microbiome Presentation 4-23-19.pptx
DHC Microbiome Presentation 4-23-19.pptxDHC Microbiome Presentation 4-23-19.pptx
DHC Microbiome Presentation 4-23-19.pptx
DivyanshGupta922023
 
developer-burnout.pdf
developer-burnout.pdfdeveloper-burnout.pdf
developer-burnout.pdf
DivyanshGupta922023
 
AzureIntro.pptx
AzureIntro.pptxAzureIntro.pptx
AzureIntro.pptx
DivyanshGupta922023
 
Internet of Things.pptx
Internet of Things.pptxInternet of Things.pptx
Internet of Things.pptx
DivyanshGupta922023
 
Functional JS+ ES6.pptx
Functional JS+ ES6.pptxFunctional JS+ ES6.pptx
Functional JS+ ES6.pptx
DivyanshGupta922023
 
AAAI19-Open.pptx
AAAI19-Open.pptxAAAI19-Open.pptx
AAAI19-Open.pptx
DivyanshGupta922023
 
10-security-concepts-lightning-talk 1of2.pptx
10-security-concepts-lightning-talk 1of2.pptx10-security-concepts-lightning-talk 1of2.pptx
10-security-concepts-lightning-talk 1of2.pptx
DivyanshGupta922023
 
Introduction to Directed Acyclic Graphs.pptx
Introduction to Directed Acyclic Graphs.pptxIntroduction to Directed Acyclic Graphs.pptx
Introduction to Directed Acyclic Graphs.pptx
DivyanshGupta922023
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
DivyanshGupta922023
 
01-React js Intro.pptx
01-React js Intro.pptx01-React js Intro.pptx
01-React js Intro.pptx
DivyanshGupta922023
 
Nextjs13.pptx
Nextjs13.pptxNextjs13.pptx
Nextjs13.pptx
DivyanshGupta922023
 
Git mercurial - Git basics , features and commands
Git mercurial - Git basics , features and commandsGit mercurial - Git basics , features and commands
Git mercurial - Git basics , features and commands
DivyanshGupta922023
 
Fundamentals and basics of Git and commands
Fundamentals and basics of Git and commandsFundamentals and basics of Git and commands
Fundamentals and basics of Git and commands
DivyanshGupta922023
 
(Public) FedCM BlinkOn 16 fedcm and privacy sandbox apis
(Public) FedCM BlinkOn 16 fedcm and privacy sandbox apis(Public) FedCM BlinkOn 16 fedcm and privacy sandbox apis
(Public) FedCM BlinkOn 16 fedcm and privacy sandbox apis
DivyanshGupta922023
 
DevOps The Buzzword - everything about devops
DevOps The Buzzword - everything about devopsDevOps The Buzzword - everything about devops
DevOps The Buzzword - everything about devops
DivyanshGupta922023
 
Git Basics walkthough to all basic concept and commands of git
Git Basics walkthough to all basic concept and commands of gitGit Basics walkthough to all basic concept and commands of git
Git Basics walkthough to all basic concept and commands of git
DivyanshGupta922023
 
jquery summit presentation for large scale javascript applications
jquery summit  presentation for large scale javascript applicationsjquery summit  presentation for large scale javascript applications
jquery summit presentation for large scale javascript applications
DivyanshGupta922023
 
DHC Microbiome Presentation 4-23-19.pptx
DHC Microbiome Presentation 4-23-19.pptxDHC Microbiome Presentation 4-23-19.pptx
DHC Microbiome Presentation 4-23-19.pptx
DivyanshGupta922023
 
10-security-concepts-lightning-talk 1of2.pptx
10-security-concepts-lightning-talk 1of2.pptx10-security-concepts-lightning-talk 1of2.pptx
10-security-concepts-lightning-talk 1of2.pptx
DivyanshGupta922023
 
Introduction to Directed Acyclic Graphs.pptx
Introduction to Directed Acyclic Graphs.pptxIntroduction to Directed Acyclic Graphs.pptx
Introduction to Directed Acyclic Graphs.pptx
DivyanshGupta922023
 
Ad

Recently uploaded (19)

Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
Ad

api-driven-development.pdf

  • 1. API Driven Development Kenneth Reitz How I Develop Things and Why.
  • 2. Hi.
  • 7. Httpbin.org $ curl http://httpbin.org/get?test=1 { "url": "http://httpbin.org/get", "headers": { "Content-Length": "", "Connection": "keep-alive", "Accept": "*/*", "User-Agent": "curl/7.21.4 ...", "Host": "httpbin.org", "Content-Type": "" }, "args": { “test”: “1” }, "origin": "67.163.102.42" }
  • 8. Et Cetera • Legit: Git Workflow for Humans • Envoy: Subprocess for Humans • Tablib: Tabular Data for Humans • Clint: CLI App Toolkit • Autoenv: Magic Shell Environments • OSX-GCC-Installer: Provokes Lawyers 275+ More
  • 10. We’re Diverse. • Product guys: non-tech cofounders • Sales guys: hustlers • Marketers: spammers • Designers: pixel pushers • Developers: code monkeys We come from many backgrounds.
  • 11. What do we have in common?
  • 12. We’re Makers. • Product guys: visionaries • Sales guys: sustainability • Marketers: communication • Designers: experience and philosophy • Developers: make the magic We craft experiences & interfaces.
  • 14. — Steve Jobs, 1983 People are going to be spending two or three hours a day with these machines — more than they spend with a car.
  • 15. — Steve Jobs, 1983 Software design must be given at least as much consideration as we give automobiles today — if not a lot more.
  • 17. Beautiful Interfaces. • Industrial Design • Web Interfaces • iOS, Android, Mobile Apps • Desktop Clients & Applications Today, beautiful applications abound.
  • 19. Developers spend 8+ hours a day with APIs. Why are they treated differently?
  • 20. Web Application Management Tools Supporting Services Tools & Utilities Web Process Worker Process Scheduled Tasks Deferred Tasks API Service CRUD Admin Data Persistence User Interface Authentication
  • 21. API Service End Users API Service Internal API Service Developers ( ) Data Persistence Message Queue Workers
  • 22. Everything is a remix*. * APIs Rule Everything Around Us.
  • 23. How?
  • 25. A Real, Tangible Problem. You can't solve a problem properly if you don't experience it firsthand.
  • 26. Example: OneNote. • Hierarchical, freeform note-taking software that assumes nothing. • Only available on Windows. • I want to make OneNote for OS X. • It would be incredible. The finest note-taking platform on earth.
  • 27. GitHub Success • GitHub wasn't built for the developer community at large. • Resonated with millions of developers. • They themselves happen to be developers. Over two million people collaborating.
  • 28. Other’s Success • Gumroad, built for the founder. • 37 Signals product, build for the team. • Ruby on Rails, by Rubyists for Rubyists.
  • 29. Optimization • Feature driven development? • Profit driven development? • Growth driven development? • Problem driven development. What drives your decisions?
  • 30. pra•gmat•ic |pragˈmatik|, adj: Dealing with things sensibly and realistically in a way that is based on practical rather than theoretical considerations
  • 31. We know Ruby... require 'net/http' require 'uri' uri = URI.parse('https://api.github.com/user') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Get.new(uri.request_uri) req.basic_auth('username', 'password') r = http.request(req) puts r
  • 32. import urllib2 gh_url = 'https://api.github.com/user' req = urllib2.Request(gh_url) password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() password_manager.add_password(None, gh_url, 'user', 'pass') auth_manager = urllib2.HTTPBasicAuthHandler(password_manager) opener = urllib2.build_opener(auth_manager) urllib2.install_opener(opener) handler = urllib2.urlopen(req) print handler.read()
  • 33. import re class HTTPForcedBasicAuthHandler(HTTPBasicAuthHandler): auth_header = 'Authorization' rx = re.compile('(?:.*,)*[ t]*([^ t]+)[ t]+' 'realm=(["'])(.*?)2', re.I) def __init__(self, *args, **kwargs): HTTPBasicAuthHandler.__init__(self, *args, **kwargs) def http_error_401(self, req, fp, code, msg, headers): url = req.get_full_url() response = self._http_error_auth_reqed( 'www-authenticate', url, req, headers) self.reset_retry_count() return response
  • 34. Admit it. You’d leave and never come back.
  • 35. This is a serious problem. HTTP should be as simple as a print statement.
  • 37. Let’s Break it Down. • A small set of methods with consistent parameters. • HEAD, GET, POST, PUSH, PUT, PATCH, DELETE, &c. • They all accept Headers, URL Parameters, Body/Form Data. What is HTTP at its core?
  • 40. import requests url = 'https://api.github.com/user' auth = ('username', 'password') r = requests.get(url, auth=auth) print r.content
  • 42. Achievement Unlocked! • A small set of methods with consistent parameters. • HEAD, GET, POST, PUSH, PUT, PATCH, DELETE, &c. • They all accept Headers, URL Parameters, Body/Form Data.
  • 43. Requests Success • Python is a language built for Humans. • Why should HTTP be non-trivial? • I explored and discovered what I really needed, and built it. • I had a real problem that I solved for myself.
  • 44. Requests Success • At first, Requests was far from powerful. • But, it deeply resonated with people. • Features grew over time, but the API was never compromised. • Quite popular.
  • 45. Developers spend 8+ hours a day with APIs. Build for yourself—a developer.
  • 48. • Before any code is written, write the README — show some examples. • Write some code with the theoretical code that you’ve documented.
  • 49. Achievement Unlocked! • Instead of engineering something to get the job done, you interact with the problem itself and build an interface that reacts to it. • You discover it. You respond to it.
  • 50. • Great sculptures aren’t engineered or manufactured— they’re discovered. • The sculptor studies and listens to the marble. He identifies with it. • Then, he responds. • Setting free something hidden Sculptures, Etc.
  • 51. • It’s not about a design that will “work” on a phone, tablet, and desktop. • It’s about making something that identifies itself enough to respond to the environment it’s placed in. • Free of arbitrary constraints. Responsive Design
  • 54. • Once you discover the API: build it. • Write all the code necessary to make exactly what you documented happen. • Complex code? Layer your API. • “Porcelain” layer is documented. Responsive Design
  • 55. The API is all that matters. Everything else is secondary.
  • 56. Do unto others as you would have them do to you? Build tools for others that you want to be built for you.
  • 60. Build for Open Source • Components become concise & decoupled. • Concerns separate themselves. • Best practices emerge (e.g. no creds in code). • Documentation and tests become crucial.
  • 61. Build for Open Source • Components become concise & decoupled. • Concerns separate themselves. • Best practices emerge (e.g. no creds in code). • Documentation and tests become crucial.
  • 62. Build for Services • Components become concise & decoupled. • Concerns separate themselves. • Best practices emerge (e.g. ideal tools). • Documentation and contracts become crucial. • Services can be scaled separately at
  • 63. — Pieter Hintjens Simplicity is always better than functionality.