APIs

(for beginners)
1. API Basics
2. How does it work

3. Demo
4. Webhooks
Application
Programming
Interface
APIs expose
something useful
An Interface
Used by a Program
To interact with

an Application
No (direct)
human usage
of APIs
Developers
write Programs
which consumes APIs
API Consumption
Web APIs
API
API
API
API
Web-101
Web-101
Web-101
Web-101
Human interface
Readable content

HTML / CSS
API
Programming interface
Structured data
{"richestPeople":[
{"firstName":"Bill", “lastName":"Gates", “value":"81"},
{"firstName":"Carlos", “lastName":"Slim", “value”:"79"},
{"firstName":"Warren", “lastName":"Buffet", "value":"72"}
]}
Let’s compare
https://api.github.com/users/devitagus
https://github.com/devitagus
Github website
Github API
Let’s play with Facebook graph API
Daily life
examples
Maps
Maps
Google Maps API
Login
Aggregators
Payments
Twilio API
UBER
Shares of Twilio (NYSE:TWLO) have more than quadrupled from its IPO price of $15.
Favspot
http://www.programmableweb.com/category/all/apis
As a developer,
I want to show venues

of next gigs in town on

a map
Timeout content manager
will enter venue addresses
Timeout content manager
doesn’t know
GPS coordinates of venues
There’s an API for that
Google Geocoding API
developers.google.com/maps/documentation/geocoding/
10 Downing St, London
10 Downing St, London
{
"location" : {
"lat" : 51.5034066,
"lng" : -0.1275923
}
} This is called JSON
How does it work?
API call is an HTTP request
https://maps.googleapis.com/maps/api/geocode/json?address=10 Downing St, London
Are we done?
We should now
integrate the
Google Maps API
http://maps.google.com/maps?
q=51.503066,-0.1275923
I want the app to
send text messages
if a gig is cancelled
Let’s look at some code
Step 1 - Sign up to Twilio
Step 2 - Fetch credentials
Step 3 - Write some ruby
require 'twilio-ruby'
account_sid = 'AC__________'
auth_token = '_____________'
client = Twilio::REST::Client.new(account_sid, auth_token)
client.messages.create(
from: '+336123456789',
to: '+3370000000000',
body: 'Hi buddy, you should attend Le Wagon!'
)
Step 4 - Run code
Your program sent a text!
WEBHOOKS
(API )-1
Don’t call us, we’ll call you
Webhook vs API call
API My app
API Call
Webhook vs API call
API My app
WEBHOOK
API Call
EXAMPLE
Typeform, please
call notify me as soon
a new member applied
Webhook
Typeform to capture leads
Slack for my sales team
Lead Management
API
Service B exposes methods
to read, create or update data
WEBHOOK
Typeform pushes data
as soon as available
API
Slack exposes methods
to read, create or update data
Introducing Zapier
Demo
When you’ll hit
Zapier's limit, come
learn to code at
Le Wagon!
Thank you!

API for Beginners