SlideShare a Scribd company logo
1 of 21
Download to read offline
Getting Started With Public
APIs
Eryn O’Neil • @eryno
Today’s Agenda
● Evaluating an API
● Authentication
● Testing (“Hello, API!”)
● Now What?
Today’s (and Forever’s) Ground Rules:
● If you don’t understand: Ask.
● No, really. Ask! No dumb questions.
● If you get too into the weeds, I might cut you off.
But err on the side of asking.
Most important ground rule:
Don’t be afraid to start slow and enjoy yourself.
So you don’t know how OAuth works. So what? You don’t need to yet.
You aren’t less of a programmer if you abstract away the complicated parts or don’t
know what “endpoint” means. (It’s just a fancy word for “URL”, anyway).
We all start somewhere.
Evaluating an API
Or: Um, which one should I pick?
Where should I start?
Prioritize ease of use over popularity.
Reasonable Approaches
● Flickr
● Last.fm
● Twilio
● Lots and lots of other sites
There Be Dragons
● Twitter
● Facebook
Evaluating an API: Documentation
Evaluating an API: Documentation
Authentication
Or: “I promise I’m me” isn’t good enough for you?
Authentication
Authentication can be hard to
implement well. Fortunately, you
aren’t implementing it.
Common methods:
● No authentication
● HTTP Basic Authentication
● HMAC
● OAuth / OAuth2
Authentication: None!
Not very common, because it’s harder to limit abuse.
But if you find one, they make a great place to learn your tools.
Keep APIs available with one weird trick: Don’t be a jerk.
Example: http://jsonplaceholder.typicode.com/
Authentication: HTTP Basic Authentication
HTTP Basic Auth is as old as the internet and baked into every web browser. It’s not
the most secure method, but it is very convenient.
How it works:
1. Get a username and password
2. Base64 encode the string “username:password”
3. Pass the base64-encoded string as an HTTP header named Authorization.
4. Done.
Authentication: HTTP Basic Authentication
Practically speaking…
1. Use PHP:
2. Send it in the URL:
http://username:password@www.example.com/
3. Use Postman.
“Um, what’s Postman?”
I’m so glad you asked.
https://www.getpostman.com/
Authentication: HMAC & OAuth
HMAC = [keyed-]Hash Message Authentication Code
A pre-agreed upon way of hashing several pieces of data-- usually a username, a
secret key or password, the request being made (URL), and something that
changes every request (like a timestamp).
OAuth isn’t an acronym, but it basically means “Open Authentication”
An implementation of HMAC, plus a standard script for HTTP calls that allows a
client (ex: you) to authenticate against a server (ex: Twitter) asynchronously.
Authentication: HMAC & OAuth
They’re both great, but they’re a little complicated to describe in this talk.
One day you may write an OAuth server or client. That will be a great time to learn
more about it.
Until then: Use the magic OAuth button in Postman.
Okay, I got my instant gratification. I
need more than Postman. Now what?
Write something!
Slim: http://www.slimframework.com/
Possibilities
Download listening data from Last.fm and find out how many people are both
Metallica fans and One Direction fans.
Write a script that auto-rejects LinkedIn requests for every recruiter that emails you
with a job that has nothing to do with your skills.
Automatically pull every cat photo from Flickr and change your desktop every 15
minutes. (You won’t get through every cat photo, but if you try to do it in real time
you’ll probably freeze your machine.)
I hate those ideas.
Where can I find more?
http://www.programmableweb.com/apis/directory
So, what are you going to build?
(Thanks!)

More Related Content

Similar to Getting Started with Public APIs

Understanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chkUnderstanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chk
nooreen nayyar syeda
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
Tomas Doran
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
Tomas Doran
 

Similar to Getting Started with Public APIs (20)

Cloud Foundry API for Fun and Ops
Cloud Foundry API for Fun and OpsCloud Foundry API for Fun and Ops
Cloud Foundry API for Fun and Ops
 
Securing REST APIs
Securing REST APIsSecuring REST APIs
Securing REST APIs
 
Understanding APIs.pptx
Understanding APIs.pptxUnderstanding APIs.pptx
Understanding APIs.pptx
 
Understanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chkUnderstanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chk
 
HTTP Basics Demo
HTTP Basics DemoHTTP Basics Demo
HTTP Basics Demo
 
Secure Your REST API (The Right Way)
Secure Your REST API (The Right Way)Secure Your REST API (The Right Way)
Secure Your REST API (The Right Way)
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
 
Http to Https Get your WordPress website Compliant!
Http to Https Get your WordPress website Compliant!Http to Https Get your WordPress website Compliant!
Http to Https Get your WordPress website Compliant!
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api fundamentals
Api fundamentalsApi fundamentals
Api fundamentals
 
HTTP - The Protocol of Our Lives
HTTP - The Protocol of Our LivesHTTP - The Protocol of Our Lives
HTTP - The Protocol of Our Lives
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
Introduction to PHP.pptx
Introduction to PHP.pptxIntroduction to PHP.pptx
Introduction to PHP.pptx
 

Recently uploaded

原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
pxcywzqs
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
ydyuyu
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 

Recently uploaded (20)

Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime BalliaBallia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Local Call Girls in Seoni 9332606886 HOT & SEXY Models beautiful and charmin...
Local Call Girls in Seoni  9332606886 HOT & SEXY Models beautiful and charmin...Local Call Girls in Seoni  9332606886 HOT & SEXY Models beautiful and charmin...
Local Call Girls in Seoni 9332606886 HOT & SEXY Models beautiful and charmin...
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 

Getting Started with Public APIs

  • 1. Getting Started With Public APIs Eryn O’Neil • @eryno
  • 2. Today’s Agenda ● Evaluating an API ● Authentication ● Testing (“Hello, API!”) ● Now What?
  • 3. Today’s (and Forever’s) Ground Rules: ● If you don’t understand: Ask. ● No, really. Ask! No dumb questions. ● If you get too into the weeds, I might cut you off. But err on the side of asking.
  • 4. Most important ground rule: Don’t be afraid to start slow and enjoy yourself. So you don’t know how OAuth works. So what? You don’t need to yet. You aren’t less of a programmer if you abstract away the complicated parts or don’t know what “endpoint” means. (It’s just a fancy word for “URL”, anyway). We all start somewhere.
  • 5. Evaluating an API Or: Um, which one should I pick?
  • 6. Where should I start? Prioritize ease of use over popularity.
  • 7. Reasonable Approaches ● Flickr ● Last.fm ● Twilio ● Lots and lots of other sites There Be Dragons ● Twitter ● Facebook
  • 8. Evaluating an API: Documentation
  • 9. Evaluating an API: Documentation
  • 10. Authentication Or: “I promise I’m me” isn’t good enough for you?
  • 11. Authentication Authentication can be hard to implement well. Fortunately, you aren’t implementing it. Common methods: ● No authentication ● HTTP Basic Authentication ● HMAC ● OAuth / OAuth2
  • 12. Authentication: None! Not very common, because it’s harder to limit abuse. But if you find one, they make a great place to learn your tools. Keep APIs available with one weird trick: Don’t be a jerk. Example: http://jsonplaceholder.typicode.com/
  • 13. Authentication: HTTP Basic Authentication HTTP Basic Auth is as old as the internet and baked into every web browser. It’s not the most secure method, but it is very convenient. How it works: 1. Get a username and password 2. Base64 encode the string “username:password” 3. Pass the base64-encoded string as an HTTP header named Authorization. 4. Done.
  • 14. Authentication: HTTP Basic Authentication Practically speaking… 1. Use PHP: 2. Send it in the URL: http://username:password@www.example.com/ 3. Use Postman.
  • 15. “Um, what’s Postman?” I’m so glad you asked. https://www.getpostman.com/
  • 16. Authentication: HMAC & OAuth HMAC = [keyed-]Hash Message Authentication Code A pre-agreed upon way of hashing several pieces of data-- usually a username, a secret key or password, the request being made (URL), and something that changes every request (like a timestamp). OAuth isn’t an acronym, but it basically means “Open Authentication” An implementation of HMAC, plus a standard script for HTTP calls that allows a client (ex: you) to authenticate against a server (ex: Twitter) asynchronously.
  • 17. Authentication: HMAC & OAuth They’re both great, but they’re a little complicated to describe in this talk. One day you may write an OAuth server or client. That will be a great time to learn more about it. Until then: Use the magic OAuth button in Postman.
  • 18. Okay, I got my instant gratification. I need more than Postman. Now what? Write something! Slim: http://www.slimframework.com/
  • 19. Possibilities Download listening data from Last.fm and find out how many people are both Metallica fans and One Direction fans. Write a script that auto-rejects LinkedIn requests for every recruiter that emails you with a job that has nothing to do with your skills. Automatically pull every cat photo from Flickr and change your desktop every 15 minutes. (You won’t get through every cat photo, but if you try to do it in real time you’ll probably freeze your machine.)
  • 20. I hate those ideas. Where can I find more? http://www.programmableweb.com/apis/directory
  • 21. So, what are you going to build? (Thanks!)