Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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.

Randall Degges

October 15, 2016
Tweet

More Decks by Randall Degges

Other Decks in Programming

Transcript

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

    View Slide

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

    View Slide

  3. Wanna talk
    about APIs?
    APIs are
    the best!
    I want
    an API!

    View Slide

  4. What the
    hell are
    they?!

    View Slide

  5. APIs are
    websites made
    for computers

    View Slide

  6. Websites for humans
    are horrible.

    View Slide

  7. View Slide

  8. View Slide




  9. Hi!


    Hello, world!


    HTML!!!!

    View Slide

  10. body {
    padding: 2em;
    }
    h1 {
    font-size: 3em;
    color: #000;
    }
    CSS!!!!

    View Slide

  11. $(document).ready(function() {
    $("Hello, world!").insertAfter("h1");
    });
    Javascript :(

    View Slide

  12. JUST
    DATA

    View Slide

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

    View Slide

  14. {
    "username": "rdegges",
    "firstName": "Randall",
    "lastName": "Degges",
    "email": "[email protected]"
    }
    JSON

    View Slide



  15. rdegges
    Randall
    Degges
    [email protected]

    XML

    View Slide

  16. How do
    computers talk
    to an API?

    View Slide

  17. HTTP Request
    Headers
    Body
    Metadata
    Data

    View Slide

  18. HTTP Response
    Headers
    Body
    They
    look the
    same!

    View Slide

  19. GET
    POST
    PUT
    PATCH
    DELETE

    View Slide

  20. GET https://api.mywebsite.com/messages
    {
    "messages": [
    {
    "id": 1,
    "text": "Hey Randall! Cool slide art!"
    },
    {
    "id": 2,
    "text": "Great talk, too!"
    }
    ]
    }

    View Slide

  21. POST https://api.mywebsite.com/messages
    {
    "text": "I’m storing a new message!"
    }
    {
    "id": 3,
    "text": "I’m storing a new message!"
    }

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  25. APIs are pretty
    cool, after all!

    View Slide

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

    View Slide

  27. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  31. View Slide

  32. My website is now
    very secure!
    Hahaha.

    View Slide

  33. View Slide

  34. APIs Are Magical!

    View Slide

  35. You’re
    awesome.
    @rdegges
    @gostormpath

    View Slide