WTF Are APIs?!

WTF Are APIs?!

Do people keep talking to you about APIs? Are these people starting to drive you crazy? Are you frustrated at night when you go to bed because you don’t really understand just what the f**k APIs actually are? If this describes you then you won’t want to miss this talk!

In this talk, Randall Degges, Developer Evangelist at Stormpath, will teach you what APIs are, how they work, and how to use them. You’ll also take a look at several free and popular API services, and learn how to make use of them.

56badf521701d4f9b3a394d3ef6e90c4?s=128

Randall Degges

October 15, 2016
Tweet

Transcript

  1. WTF Are APIs?! Seriously, wtf are they? @rdegges @gostormpath

  2. Hey, I’m Randall Developer Evangelist, Stormpath Open Source Dude <333

    t3h c0d3z
  3. Wanna talk about APIs? APIs are the best! I want

    an API!
  4. What the hell are they?!

  5. APIs are websites made for computers

  6. Websites for humans are horrible.

  7. None
  8. None
  9. <html> <head> <meta charset="utf-8"> <title>Hi!</title> </head> <body> <h1>Hello, world!</h1> </body>

    </html> HTML!!!!
  10. body { padding: 2em; } h1 { font-size: 3em; color:

    #000; } CSS!!!!
  11. $(document).ready(function() { $("<p>Hello, world!").insertAfter("h1"); }); Javascript :(

  12. JUST DATA

  13. $ curl https://api.ipify.org 73.15.98.183 $ curl http://swapi.co/api/people/1/

  14. { "username": "rdegges", "firstName": "Randall", "lastName": "Degges", "email": "randall@stormpath.com" }

    JSON
  15. <?xml version="1.0" encoding="UTF-8"?> <user> <username>rdegges</username> <firstName>Randall</firstName> <lastName>Degges</lastName> <email>randall@stormpath.com</email> </user> XML

  16. How do computers talk to an API?

  17. HTTP Request Headers Body Metadata Data

  18. HTTP Response Headers Body They look the same!

  19. GET POST PUT PATCH DELETE

  20. GET https://api.mywebsite.com/messages { "messages": [ { "id": 1, "text": "Hey

    Randall! Cool slide art!" }, { "id": 2, "text": "Great talk, too!" } ] }
  21. POST https://api.mywebsite.com/messages { "text": "I’m storing a new message!" }

    { "id": 3, "text": "I’m storing a new message!" }
  22. PUT https://api.mywebsite.com/messages/1 { "id": 1, "text": "Hey Randall! BAD slide

    art!" } { "id": 1, "text": "Hey Randall! BAD slide art!" }
  23. PATCH https://api.mywebsite.com/messages/1 { "text": "Hey Randall! Booorrring." } { "id":

    1, "text": "Hey Randall! Booorrring." }
  24. DELETE https://api.mywebsite.com/messages/1 { "id": 1, "text": "Hey Randall! Booorrring." }

  25. APIs are pretty cool, after all!

  26. https://www.publicapis.com/

  27. None
  28. POST https://api.twilio.com/2010-04-01/Accounts/<id>/Calls.json { "From": "+14158675309", "To": "+18182179229", "Url": "https://mywebsite.com/call.xml" }

  29. POST https://api.twilio.com/2010-04-01/Accounts/<id>/Messages.json { "From": "+14158675309", "To": "+18182179229", "Body": "Hey Randall!!"

    }
  30. You mean I can use an API to ship stuff?!

    Cool!
  31. None
  32. My website is now very secure! Hahaha.

  33. None
  34. APIs Are Magical!

  35. You’re awesome. @rdegges @gostormpath