SlideShare a Scribd company logo
APIs:
The future of the Web
Reuven M. Lerner • reuven@lerner.co.il
February 27th, 2014
Web APIs:
The future of software
Reuven M. Lerner • reuven@lerner.co.il
February 27th, 2014
In the Beginning,
There were Ones and Zeroes.
Software
•

Software is the magical collection of instructions
that control a computer

•

At the end of the day, we know that there are ones
and zeroes in there.

•

No matter what language you use, the programs
you write are turned into ones and zeroes when
they are executed.
Abstraction
•

So, why not just use ones and zeroes?

•

Abstraction: One of the most important concepts in
computer science!

•

Abstraction lets you think big thoughts, not
worrying about the underlying infrastructure or
implementation
Web APIs: The future of software
High level
•

The greatest abstractions happen in "high-level"
languages, such as Python, Ruby, JavaScript, and
Lisp
•

In low-level languages, I work hard to suit the
computer.

•

But in high-level languages, the computer works
hard to suit me, by black-boxing the details!
Web APIs: The future of software
Repetition
•

No matter what language you use, you'll eventually
find yourself repeating code.

•

How can you deal with this problem?

•

Put the code in a common place, and then use it
again and again.

•

Write it once, and then use it — ignoring the
implementation
Web APIs: The future of software
Programmer virtues
•

"The three virtues of a programmer: laziness,
impatience, and hubris" — Larry Wall

•

Laziness: Write it once, and then reuse it many
times!
DRY
•

This leads directly to the idea of DRY — write code
only once.

•

Don't repeat yourself!

•

Don't repeat yourself!
Libraries of code
•

Writing libraries of code, which can then be used
by many different programs, is an extremely
common programming task.

•

With a library, we can concentrate on the most
important things to our business, rather than focus
on infrastructure.
API
•

"Application Programming Interface"

•

What is the interface to a library of code?
•

Function/method names

•

Effects (what each function does)

•

Parameters expected by each function

•

Return value(s) from each function

•

What happens if there was an error?
Modern operating systems
•

What is an operating system? A bunch of libraries
that abstract away the hardware and many other
aspects of computers:
•

Networking

•

Printing

•

Running multiple programs

•

Drawing to the screen
Operating systems
•

In other words, an operating system is just a
collection of APIs!

•

You can write your own printing system, but why
bother? Just use the printing API that the operating
system provides.
From Wikipedia
•

Win32 (Windows)
•

•

The Windows API, informally WinAPI, is Microsoft's
core set of application programming interfaces
(APIs) available in the Microsoft Windows operating
systems.

Cocoa (Mac OS X)
•

Cocoa is Apple's native object-oriented application
programming interface (API) for the OS X operating
system.
Web APIs: The future of software
RPC
•

"Remote procedure call"

•

Don't invoke a library on the local computer —
rather, invoke it on another computer!

•

Abstraction #1: The software library does some
task for me

•

Abstraction #2: I don't have to know how that things
are executing remotely
What is the Web?
•

URLs — what I want, where it's located, and how I
get there

•

HTTP — a great way to get there

•

HTML — a type of content
The entire Web, explained

•

A browser sends an HTTP request to a server.

•

The server sends a response (perhaps content,
perhaps an error message, perhaps a redirect),
and hangs up.
What if machines browsed,
and not humans?
•

The Web was designed for people.

•

But you know, the combination of URLs, HTTP, and
HTML could be used by computers, too.

•

And then you wouldn't need to have a "browser"
sending a request. It could be any program, right?
XML
•

"Extensible markup language"

•

Not a markup language, but rather a way to define
new markup languages!

•

Now computers can send requests and get results
not in human-centric HTML, but in machine-centric
XML.
XML-RPC
•

Dave Winer suggested that we could use a
combination of XML and HTTP for RPC!
•
•

Works across programming languages

•

Used libraries (XML, HTTP) that already existed

•
•

Works across the Internet

Set up a client or server in minutes!

But is this really RPC? Actually, yes!
SOAP
•

Simple Object Access Protocol

•

Officially: A more modern, well-defined version of
XML-RPC

•

Realistically: Massive overhead and complexity
"Web Services"
•

Both XML-RPC and SOAP are protocols that let you
advertise Web services

•

In other words: APIs against which we can make
calls from anywhere on the Internet!

•

There's a whole alphabet soup of standards that
were written to address this problem.

•

But today, APIs are often cleaner and leaner than
this, implemented in different ways
REST
•

Representational State Transfer (Roy Fielding)

•

URLs should be nouns, and different HTTP actions
should describe the actions on those nouns

•

Not a lot of documentation is needed, because
REST standardizes how things look on the outside

•

Wait, how does it look on the inside? What does
the implementation look like?
Web APIs: The future of software
JSON
•

JavaScript is everywhere!

•

And JavaScript syntax is easy to understand

•

So Douglas Crockford created "JSON" —
JavaScript Object Notation — which makes XMLRPC look clunky and fat by comparison

•

A huge number of programming languages
support JSON
REST + JSON
•

Modern APIs are thus standardized via REST, and
exchange data using JSON

•

Many frameworks, such as Ruby on Rails, make it
trivially easy to create RESTful JSON APIs
Web APIs: The future of software
Um. OK.
•

Web APIs let programs talk to other programs.

•

And? Why should I care? And how is this the
future of software?

•

Two reasons:
•

All software is moving online, and

•

The entire Internet is becoming our OS!
If an OS is a collection of APIs you can
call, then the Internet is becoming a
massively distributed OS!
In other words
•

Build the parts of your application that are special
and specific for you.

•

The rest of your application should leverage APIs
on the Web

•

And by the way, your application can offer APIs as
well, leading to a complex web of API calls!
Example: FedEx
•

One of the first companies to offer an API

•

(Yes, beyond the Web site!)

•

Benefit to your company: Create custom software
that handles all of your package needs, with the
appropriate permissions and reporting

•

Benefit to FedEx: Lock-in, customer satisfaction
Example: Payment
•

It used to be difficult to deal with payment and ecommerce — because you implemented it yourself

•

But now we have APIs that make it easier to deal
with. PayPal, Strip, Dwolla, Amazon, PayByGroup.

•

How can we simplify the API? Simple: Offer a
library that wraps up those APIs.

•

Charging credit cards becomes a one-line task!
Example: Authentication
•

Why store usernames and passwords?
•
•

Users need to remember another password

•
•

People don't trust you

You're vulnerable

Solution: Let people log in via Facebook, LinkedIn,
Google, etc.
Web APIs: The future of software
Example: New York Times
What does this mean?
•

The New York Times is not only a source for news.

•

It's now a source for data that people can use to
inform others.

•

It becomes a platform on which you can create
new content, and do meta-reporting
Weather APIs
•

wunderground.com offers APIs to current weather
data

•

Get weather data, and integrate it into your app

•

Location-aware apps on your phone can use this to
show weather wherever you are!
Amazon Web Services
•

Everything is available via an API!

•

Start new servers, shut down existing servers, and
monitor servers — all via APIs

•

Your application can thus spin up (and spin down)
entire servers whenever it needs, using nothing
more than URLs and JSON!
Amazon?!?
•

Yes, they make billions off of their cloud servers

•

You can manage those servers via various APIs

•

Want to manage buying, selling, and management
of products on Amazon? Sure, there are APIs for
those, too…
Geocoding
•

Have a street address, and want to know its
longitude and latitude?

•

Have an IP address, and want to know its country?

•

There are APIs for this, generally from mapping
companies (e.g., Google, Bing, MapQuest)
Geocoding IP address
def geocoder_decode(ip_address)
Geocoder.search(ip_address).location rescue nil
end
A/B Testing
•

optimize.ly lets you do A/B ("split") testing on your
Web site by including a snippet of JavaScript

•

How does it work? By accessing Optimizely's API

•

How can you modify its behavior? By accessing
Optimizely's API from your own program!
Storage
•

Dropbox and Google Drive offer APIs!

•

Store and retrieve Dropbox documents from within
your program

•

Use Dropbox for storage, and it automatically
replicates!
Facebook
•

Get access to a user's personal information —
name, address, and interests

•

You also get information about the person's friends!

•

This is potentially a huge privacy issue! So users
need to agree to add Facebook API applications,
and specifically see what capabilities apps want

•

(The same is true for LinkedIn, of course.)
Twitter

•

Twitter has long offered an API, allowing anyone to
tweet from within a program

•

(You can also read and search through tweets)
Using the API
def tweet_person
Twitter.update("Welcome, #{fullname}, to the #NetLogo Modeling
Commons, our #{ActiveSupport::Inflector::ordinalize(Person.count)}
user!")
end
Web APIs: The future of software
SOA
•

Service-Oriented Architecture

•

Instead of a big Web application, write many small
ones that talk to each other via APIs!

•

Each service can then be created, updated, and
maintained by different teams. Or companies. Or
individuals.

•

Easier to create, maintain, scale, and understand
SaaS APIs
•

SaaS — software as a service

•

Applications that run on a server somewhere; they
may have a browser-side, as well.

•

A growing number of SaaS companies offer APIs.
This turns the application into something beyond
what you use it for in your browser.
Example API: Harvest
•

"Harvest," time-tracking and invoicing software, has
an API

•

The time-tracking API lets you keep track of your
time. Build a new widget or app that starts and
stops your clock, for example.

•

The extended API lets you edit your clients,
projects, and tasks!
Example API: Job seeking
•

Looking to hire people? You can use an API to post
jobs (on monster.com, linkedin.com, and
elsewhere)

•

Looking for work? You can search via an API!

•

Trying to match jobs and people? You can use
these APIs, and build a company on top of them!
Web APIs: The future of software
Example API: Search
•

Run searches against your favorite search engine
•

•

(Or run searches against multiple search
engines, and compare the results!)

All search engines provide APIs that let you build
on top of what they offer
ProgrammableWeb.com
•

Not sure what's out there?

•

ProgrammableWeb.com lists as many APIs as it
can, categorized by topic, protocol and data
format.

•

Don't reinvent the wheel — find one that has
already been rolling for a while, and integrate it!

•

(Let someone else do the hard work of
implementing things. Laziness wins again!)
Connecting
•

IFTTT ("If this, then that")

•

It's an connector for APIs!

•

You can say, "When I'm tagged in a photo on
Facebook, post a note to my blog."

•

Once a company is part of the IFTTT family, you
can connect APIs for added
Web APIs: The future of software
Mobile apps
•

Mobile apps all use APIs!

•

They usually talk to Web sites via XML or JSON

•

In other words, a mobile app has two parts
•
•

•

Client (running on the device)
Server (offering a JSON API)

Support iOS and Android? Two clients, one API!
Single-page apps
•

As browsers get smarter, more of the app is being
pushed onto the client, running in JavaScript

•

So instead of each click being a new HTTP
request, you can create a whole application in the
browser that occasionally syncs with a server

•

How does it sync? APIs, of course!

•

Google Docs work just like this
Even the browser…
•

How do programs talk to the browser? Via APIs!

•

DOM — API for us to read and update a Web page

•

Call APIs from the browser, to talk to lots of servers

•

e.g., Disqus, Facebook, LiveFyre — add
discussion to any page!
APIs on the server
•

Consume:
•

•

Logging, payment, analytics, authentication

Offer:
•

Authentication, read/write your unique data,
aggregation, analytics
Make a fortune!
•

The path to startup success:

1. Come up with an idea
2. ???
3. Profit!
What's stage 2?
•

The path to startup success:

1. Come up with an idea
2. Offer an API to information or analysis that no one
else can offer
3. Profit!
$
Opportunities in your work?
•

An API doesn't have to be big or complex

•

It can often solve simple problems — saving you
money and making you more efficient

•

Don't e-mail Excel files to one another. Rather,
create an API on a local server!
Thanks!
Any questions?
•

You can always find me at:
•

reuven@lerner.co.il

•

http://www.lerner.co.il/
•

Get my newsletter, with articles and insights like this!

•

054-496-8405

•

“reuvenlerner” on Skype

•

@reuvenmlerner on Twitter

More Related Content

PDF
Library, Library Lets Use THAT Library – DFW Mobile
PDF
Image Processing and Computer Vision in iPhone and iPad
PDF
API Description Languages
PDF
Metaprogramming Go
PDF
6 reasons Jubilee could be a Rubyist's new best friend
DOC
Ankur Bajad
PPTX
Building Amazon Alexa custom Skill step by step
KEY
Lessons from Branch's launch
Library, Library Lets Use THAT Library – DFW Mobile
Image Processing and Computer Vision in iPhone and iPad
API Description Languages
Metaprogramming Go
6 reasons Jubilee could be a Rubyist's new best friend
Ankur Bajad
Building Amazon Alexa custom Skill step by step
Lessons from Branch's launch

What's hot (18)

PDF
Flickr Architecture Presentation
PDF
Dynamic Sound for Android
PPTX
IT Camp 2019: How to build your first Alexa skill in under one hour
PPT
Workshop Trends In Open Source Tech 1 20 10
PPTX
PDF
Voice Applications with Adhearsion
PDF
Scaling Machine Learning Systems up to Billions of Predictions per Day
PPTX
The front end toolkit
PPTX
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
PPTX
Building Boston Rail - An Alexa Skill
PDF
Dynamic Sound for iOS Apps and Games
PDF
Build a Startup with Clojure(Script)
PPTX
Ionic intro + tips
PPT
Creating Interactive eBooks
PDF
OpenERP Touchscreen Point of Sale
PDF
Totally Build Apps for Free! (not really)
PDF
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
PDF
Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...
Flickr Architecture Presentation
Dynamic Sound for Android
IT Camp 2019: How to build your first Alexa skill in under one hour
Workshop Trends In Open Source Tech 1 20 10
Voice Applications with Adhearsion
Scaling Machine Learning Systems up to Billions of Predictions per Day
The front end toolkit
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
Building Boston Rail - An Alexa Skill
Dynamic Sound for iOS Apps and Games
Build a Startup with Clojure(Script)
Ionic intro + tips
Creating Interactive eBooks
OpenERP Touchscreen Point of Sale
Totally Build Apps for Free! (not really)
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...
Ad

Viewers also liked (20)

PDF
Past, Present and Future of APIs of Mobile and Web Apps
PDF
Irc how to sept 2012
PPTX
Shamit khemka discusses Popular types of Software & their usages in Current S...
PPTX
Value driven - the future of software development
PPT
Types of software
PPT
Types of Software - Y9 Computing
PDF
Free Software and the Future of Database Technology
PDF
Proposed Growth Plan
DOCX
herramientasparaelmantenimientodelpc
PPTX
Types of software
PPTX
Software and its types
PPT
Software AND its Types & CASE toolS
PPT
Network software n othr types of software
PPSX
Types of software
PPT
Types of Software testing
PPT
Concept Maps: Types, uses, software
PPTX
VMworld 2015: The Future of Software- Defined Storage- What Does it Look Like...
PPTX
Computer Software & It's types.
PPTX
Types of application software
PPTX
types of software
Past, Present and Future of APIs of Mobile and Web Apps
Irc how to sept 2012
Shamit khemka discusses Popular types of Software & their usages in Current S...
Value driven - the future of software development
Types of software
Types of Software - Y9 Computing
Free Software and the Future of Database Technology
Proposed Growth Plan
herramientasparaelmantenimientodelpc
Types of software
Software and its types
Software AND its Types & CASE toolS
Network software n othr types of software
Types of software
Types of Software testing
Concept Maps: Types, uses, software
VMworld 2015: The Future of Software- Defined Storage- What Does it Look Like...
Computer Software & It's types.
Types of application software
types of software
Ad

Similar to Web APIs: The future of software (20)

KEY
Mobile ECM with JavaScript - JSE 2011
PPTX
Mobile application development; Complete steps
PPTX
Building a REST API for Longevity
PDF
Tech Thursdays: Building Products
PPTX
WordPress Rest API
PDF
Webapi
PPTX
OpenShift with Eclipse Tooling - EclipseCon 2012
PDF
SGCE 2015 REST APIs
PDF
APIs distribuidos con alta escalabilidad
PPTX
6.1 GeospatialWeb101.pptx.pptx
PPTX
Reaching 1 Million APIs and what to do when we get there
PPT
Joomla as a mobile App backend - ideas, examples and experiences
PPTX
Computer programminglanguages
KEY
Development of a mobile app for Android
PDF
Building A Great API - Evan Cooke, Cloudstock, December 2010
PDF
Generating docs from APIs
PDF
eMusic: WordPress in the Enterprise
PDF
Week01 jan19 introductionto_php
PDF
Mobile app development
PPTX
Inside Wordnik's Architecture
Mobile ECM with JavaScript - JSE 2011
Mobile application development; Complete steps
Building a REST API for Longevity
Tech Thursdays: Building Products
WordPress Rest API
Webapi
OpenShift with Eclipse Tooling - EclipseCon 2012
SGCE 2015 REST APIs
APIs distribuidos con alta escalabilidad
6.1 GeospatialWeb101.pptx.pptx
Reaching 1 Million APIs and what to do when we get there
Joomla as a mobile App backend - ideas, examples and experiences
Computer programminglanguages
Development of a mobile app for Android
Building A Great API - Evan Cooke, Cloudstock, December 2010
Generating docs from APIs
eMusic: WordPress in the Enterprise
Week01 jan19 introductionto_php
Mobile app development
Inside Wordnik's Architecture

More from Reuven Lerner (20)

PDF
Technical training business talk.key
PDF
Big Data — Your new best friend
PDF
PostgreSQL, your NoSQL database
PDF
Python's magic methods
PDF
What can Ruby learn from Python (and vice versa)?
PDF
Functional Python Webinar from October 22nd, 2014
PDF
Rails israel 2013
PDF
Intro to cloud computing — MegaCOMM 2013, Jerusalem
KEY
PostgreSQL
KEY
Rails traps
KEY
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
KEY
Rails development environment talk
KEY
Git talk from Open 2011 conference in Israel
PDF
Dynamic languages, for software craftmanship group
KEY
Modern Web Technologies — Jerusalem Web Professionals, January 2011
KEY
PostgreSQL talk, Database 2011 conference
PDF
ActiveRecord 2.3
KEY
Ruby objects
KEY
Rails console
KEY
Rails tools
Technical training business talk.key
Big Data — Your new best friend
PostgreSQL, your NoSQL database
Python's magic methods
What can Ruby learn from Python (and vice versa)?
Functional Python Webinar from October 22nd, 2014
Rails israel 2013
Intro to cloud computing — MegaCOMM 2013, Jerusalem
PostgreSQL
Rails traps
Modern Web technologies (and why you should care): Megacomm, Jerusalem, Febru...
Rails development environment talk
Git talk from Open 2011 conference in Israel
Dynamic languages, for software craftmanship group
Modern Web Technologies — Jerusalem Web Professionals, January 2011
PostgreSQL talk, Database 2011 conference
ActiveRecord 2.3
Ruby objects
Rails console
Rails tools

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Cloud computing and distributed systems.
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPT
Teaching material agriculture food technology
PDF
KodekX | Application Modernization Development
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Empathic Computing: Creating Shared Understanding
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
MYSQL Presentation for SQL database connectivity
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
GamePlan Trading System Review: Professional Trader's Honest Take
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Cloud computing and distributed systems.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Teaching material agriculture food technology
KodekX | Application Modernization Development
“AI and Expert System Decision Support & Business Intelligence Systems”
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Empathic Computing: Creating Shared Understanding
The Rise and Fall of 3GPP – Time for a Sabbatical?

Web APIs: The future of software

  • 1. APIs: The future of the Web Reuven M. Lerner • reuven@lerner.co.il February 27th, 2014
  • 2. Web APIs: The future of software Reuven M. Lerner • reuven@lerner.co.il February 27th, 2014
  • 3. In the Beginning, There were Ones and Zeroes.
  • 4. Software • Software is the magical collection of instructions that control a computer • At the end of the day, we know that there are ones and zeroes in there. • No matter what language you use, the programs you write are turned into ones and zeroes when they are executed.
  • 5. Abstraction • So, why not just use ones and zeroes? • Abstraction: One of the most important concepts in computer science! • Abstraction lets you think big thoughts, not worrying about the underlying infrastructure or implementation
  • 7. High level • The greatest abstractions happen in "high-level" languages, such as Python, Ruby, JavaScript, and Lisp • In low-level languages, I work hard to suit the computer. • But in high-level languages, the computer works hard to suit me, by black-boxing the details!
  • 9. Repetition • No matter what language you use, you'll eventually find yourself repeating code. • How can you deal with this problem? • Put the code in a common place, and then use it again and again. • Write it once, and then use it — ignoring the implementation
  • 11. Programmer virtues • "The three virtues of a programmer: laziness, impatience, and hubris" — Larry Wall • Laziness: Write it once, and then reuse it many times!
  • 12. DRY • This leads directly to the idea of DRY — write code only once. • Don't repeat yourself! • Don't repeat yourself!
  • 13. Libraries of code • Writing libraries of code, which can then be used by many different programs, is an extremely common programming task. • With a library, we can concentrate on the most important things to our business, rather than focus on infrastructure.
  • 14. API • "Application Programming Interface" • What is the interface to a library of code? • Function/method names • Effects (what each function does) • Parameters expected by each function • Return value(s) from each function • What happens if there was an error?
  • 15. Modern operating systems • What is an operating system? A bunch of libraries that abstract away the hardware and many other aspects of computers: • Networking • Printing • Running multiple programs • Drawing to the screen
  • 16. Operating systems • In other words, an operating system is just a collection of APIs! • You can write your own printing system, but why bother? Just use the printing API that the operating system provides.
  • 17. From Wikipedia • Win32 (Windows) • • The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. Cocoa (Mac OS X) • Cocoa is Apple's native object-oriented application programming interface (API) for the OS X operating system.
  • 19. RPC • "Remote procedure call" • Don't invoke a library on the local computer — rather, invoke it on another computer! • Abstraction #1: The software library does some task for me • Abstraction #2: I don't have to know how that things are executing remotely
  • 20. What is the Web? • URLs — what I want, where it's located, and how I get there • HTTP — a great way to get there • HTML — a type of content
  • 21. The entire Web, explained • A browser sends an HTTP request to a server. • The server sends a response (perhaps content, perhaps an error message, perhaps a redirect), and hangs up.
  • 22. What if machines browsed, and not humans? • The Web was designed for people. • But you know, the combination of URLs, HTTP, and HTML could be used by computers, too. • And then you wouldn't need to have a "browser" sending a request. It could be any program, right?
  • 23. XML • "Extensible markup language" • Not a markup language, but rather a way to define new markup languages! • Now computers can send requests and get results not in human-centric HTML, but in machine-centric XML.
  • 24. XML-RPC • Dave Winer suggested that we could use a combination of XML and HTTP for RPC! • • Works across programming languages • Used libraries (XML, HTTP) that already existed • • Works across the Internet Set up a client or server in minutes! But is this really RPC? Actually, yes!
  • 25. SOAP • Simple Object Access Protocol • Officially: A more modern, well-defined version of XML-RPC • Realistically: Massive overhead and complexity
  • 26. "Web Services" • Both XML-RPC and SOAP are protocols that let you advertise Web services • In other words: APIs against which we can make calls from anywhere on the Internet! • There's a whole alphabet soup of standards that were written to address this problem. • But today, APIs are often cleaner and leaner than this, implemented in different ways
  • 27. REST • Representational State Transfer (Roy Fielding) • URLs should be nouns, and different HTTP actions should describe the actions on those nouns • Not a lot of documentation is needed, because REST standardizes how things look on the outside • Wait, how does it look on the inside? What does the implementation look like?
  • 29. JSON • JavaScript is everywhere! • And JavaScript syntax is easy to understand • So Douglas Crockford created "JSON" — JavaScript Object Notation — which makes XMLRPC look clunky and fat by comparison • A huge number of programming languages support JSON
  • 30. REST + JSON • Modern APIs are thus standardized via REST, and exchange data using JSON • Many frameworks, such as Ruby on Rails, make it trivially easy to create RESTful JSON APIs
  • 32. Um. OK. • Web APIs let programs talk to other programs. • And? Why should I care? And how is this the future of software? • Two reasons: • All software is moving online, and • The entire Internet is becoming our OS!
  • 33. If an OS is a collection of APIs you can call, then the Internet is becoming a massively distributed OS!
  • 34. In other words • Build the parts of your application that are special and specific for you. • The rest of your application should leverage APIs on the Web • And by the way, your application can offer APIs as well, leading to a complex web of API calls!
  • 35. Example: FedEx • One of the first companies to offer an API • (Yes, beyond the Web site!) • Benefit to your company: Create custom software that handles all of your package needs, with the appropriate permissions and reporting • Benefit to FedEx: Lock-in, customer satisfaction
  • 36. Example: Payment • It used to be difficult to deal with payment and ecommerce — because you implemented it yourself • But now we have APIs that make it easier to deal with. PayPal, Strip, Dwolla, Amazon, PayByGroup. • How can we simplify the API? Simple: Offer a library that wraps up those APIs. • Charging credit cards becomes a one-line task!
  • 37. Example: Authentication • Why store usernames and passwords? • • Users need to remember another password • • People don't trust you You're vulnerable Solution: Let people log in via Facebook, LinkedIn, Google, etc.
  • 40. What does this mean? • The New York Times is not only a source for news. • It's now a source for data that people can use to inform others. • It becomes a platform on which you can create new content, and do meta-reporting
  • 41. Weather APIs • wunderground.com offers APIs to current weather data • Get weather data, and integrate it into your app • Location-aware apps on your phone can use this to show weather wherever you are!
  • 42. Amazon Web Services • Everything is available via an API! • Start new servers, shut down existing servers, and monitor servers — all via APIs • Your application can thus spin up (and spin down) entire servers whenever it needs, using nothing more than URLs and JSON!
  • 43. Amazon?!? • Yes, they make billions off of their cloud servers • You can manage those servers via various APIs • Want to manage buying, selling, and management of products on Amazon? Sure, there are APIs for those, too…
  • 44. Geocoding • Have a street address, and want to know its longitude and latitude? • Have an IP address, and want to know its country? • There are APIs for this, generally from mapping companies (e.g., Google, Bing, MapQuest)
  • 45. Geocoding IP address def geocoder_decode(ip_address) Geocoder.search(ip_address).location rescue nil end
  • 46. A/B Testing • optimize.ly lets you do A/B ("split") testing on your Web site by including a snippet of JavaScript • How does it work? By accessing Optimizely's API • How can you modify its behavior? By accessing Optimizely's API from your own program!
  • 47. Storage • Dropbox and Google Drive offer APIs! • Store and retrieve Dropbox documents from within your program • Use Dropbox for storage, and it automatically replicates!
  • 48. Facebook • Get access to a user's personal information — name, address, and interests • You also get information about the person's friends! • This is potentially a huge privacy issue! So users need to agree to add Facebook API applications, and specifically see what capabilities apps want • (The same is true for LinkedIn, of course.)
  • 49. Twitter • Twitter has long offered an API, allowing anyone to tweet from within a program • (You can also read and search through tweets)
  • 50. Using the API def tweet_person Twitter.update("Welcome, #{fullname}, to the #NetLogo Modeling Commons, our #{ActiveSupport::Inflector::ordinalize(Person.count)} user!") end
  • 52. SOA • Service-Oriented Architecture • Instead of a big Web application, write many small ones that talk to each other via APIs! • Each service can then be created, updated, and maintained by different teams. Or companies. Or individuals. • Easier to create, maintain, scale, and understand
  • 53. SaaS APIs • SaaS — software as a service • Applications that run on a server somewhere; they may have a browser-side, as well. • A growing number of SaaS companies offer APIs. This turns the application into something beyond what you use it for in your browser.
  • 54. Example API: Harvest • "Harvest," time-tracking and invoicing software, has an API • The time-tracking API lets you keep track of your time. Build a new widget or app that starts and stops your clock, for example. • The extended API lets you edit your clients, projects, and tasks!
  • 55. Example API: Job seeking • Looking to hire people? You can use an API to post jobs (on monster.com, linkedin.com, and elsewhere) • Looking for work? You can search via an API! • Trying to match jobs and people? You can use these APIs, and build a company on top of them!
  • 57. Example API: Search • Run searches against your favorite search engine • • (Or run searches against multiple search engines, and compare the results!) All search engines provide APIs that let you build on top of what they offer
  • 58. ProgrammableWeb.com • Not sure what's out there? • ProgrammableWeb.com lists as many APIs as it can, categorized by topic, protocol and data format. • Don't reinvent the wheel — find one that has already been rolling for a while, and integrate it! • (Let someone else do the hard work of implementing things. Laziness wins again!)
  • 59. Connecting • IFTTT ("If this, then that") • It's an connector for APIs! • You can say, "When I'm tagged in a photo on Facebook, post a note to my blog." • Once a company is part of the IFTTT family, you can connect APIs for added
  • 61. Mobile apps • Mobile apps all use APIs! • They usually talk to Web sites via XML or JSON • In other words, a mobile app has two parts • • • Client (running on the device) Server (offering a JSON API) Support iOS and Android? Two clients, one API!
  • 62. Single-page apps • As browsers get smarter, more of the app is being pushed onto the client, running in JavaScript • So instead of each click being a new HTTP request, you can create a whole application in the browser that occasionally syncs with a server • How does it sync? APIs, of course! • Google Docs work just like this
  • 63. Even the browser… • How do programs talk to the browser? Via APIs! • DOM — API for us to read and update a Web page • Call APIs from the browser, to talk to lots of servers • e.g., Disqus, Facebook, LiveFyre — add discussion to any page!
  • 64. APIs on the server • Consume: • • Logging, payment, analytics, authentication Offer: • Authentication, read/write your unique data, aggregation, analytics
  • 65. Make a fortune! • The path to startup success: 1. Come up with an idea 2. ??? 3. Profit!
  • 66. What's stage 2? • The path to startup success: 1. Come up with an idea 2. Offer an API to information or analysis that no one else can offer 3. Profit!
  • 67. $
  • 68. Opportunities in your work? • An API doesn't have to be big or complex • It can often solve simple problems — saving you money and making you more efficient • Don't e-mail Excel files to one another. Rather, create an API on a local server!
  • 69. Thanks! Any questions? • You can always find me at: • reuven@lerner.co.il • http://www.lerner.co.il/ • Get my newsletter, with articles and insights like this! • 054-496-8405 • “reuvenlerner” on Skype • @reuvenmlerner on Twitter