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

Building your API Utility Belt

Building your API Utility Belt

No matter the situation, Batman always had the perfect tool on hand. It didn't matter how rare, bizarre, or unique the situation was, he was ready to save the day. Unfortunately, in software development, we don't have a utility belt. At best, our tools are scripts we've cobbled together over the years that solve particular problems but leave us stuck more often than not. In this talk, we'll work to change that. This talk will introduce you to seven tools that are vital to everyday API usage and development.

Keith Casey

June 03, 2015
Tweet

More Decks by Keith Casey

Other Decks in Technology

Transcript

  1. BUILDING YOUR
    API UTILITY BELT
    D. KEITH CASEY JR. @CASEYSOFTWARE
    [email protected]

    View Slide

  2. Who am I?

    View Slide

  3. Who am I?

    View Slide

  4. Who am I?
    http://TheAPIDesignBook.com

    View Slide

  5. AGENDA
    ASSUMPTIONS
    THE PROBLEMS
    THE STATUS QUO
    THE RIGHT TOOLS

    View Slide

  6. Disclaimer
    Some of the tools and services covered here are
    open source, some are commercial products, and
    some are a blend of both.
    I have no vested interest in any of them though I
    know people at all of the companies involved.
    * Also, all pictures used without permission or attribution.

    View Slide

  7. AGENDA
    ASSUMPTIONS
    THE PROBLEMS
    THE STATUS QUO
    THE RIGHT TOOLS

    View Slide

  8. Assumptions
    You have a technical background

    APIs are an important part of your job

    Use them on a regular basis

    Potentially build them too

    Sometimes public, sometimes private

    View Slide

  9. Assumptions
    Nothing is perfect

    You make mistakes

    Your providers make mistakes

    That other team are knuckleheads

    View Slide

  10. Assumptions
    You acknowledge the real Batman

    Ben Afleck

    Christian Bale

    George Clooney

    Val Kilmer

    Michael Keaton

    View Slide

  11. Assumptions
    You acknowledge the real Batman

    Ben Afleck

    Christian Bale

    George Clooney

    Val Kilmer

    Michael Keaton

    View Slide

  12. Assumptions

    View Slide

  13. AGENDA
    ASSUMPTIONS
    THE PROBLEMS
    THE STATUS QUO
    THE RIGHT TOOLS

    View Slide

  14. The Problems…

    View Slide

  15. Only one problem:
    Testing APIs sucks.

    View Slide

  16. AGENDA
    ASSUMPTIONS
    THE PROBLEMS
    THE STATUS QUO
    THE RIGHT TOOLS

    View Slide

  17. The Status Quo…

    View Slide

  18. The Status Quo
    No wait, that sucks too.

    View Slide

  19. AGENDA
    ASSUMPTIONS
    THE PROBLEMS
    THE STATUS QUO
    THE RIGHT TOOLS

    View Slide

  20. TOOL 1:
    CURL & LIBCURL

    View Slide

  21. Background
    Completely open source with tons of integrations

    Incredible power and flexibility

    Incredible complexity

    View Slide

  22. Common Commands
    -X specify an HTTP verb

    -d specify data fields, such as for a POST

    -I return/display all the returned headers

    -H specify extra/custom headers

    View Slide

  23. Getting Started
    curl https://api.github.com

    curl -I https://api.github.com

    curl https://api.github.com/user/repos

    curl -u caseysoftware -X POST https://
    api.github.com/user/repos -d ‘{“name”:”monkey”}’

    View Slide

  24. http://curl.haxx.se/docs/manual.html
    (35 pages, no kidding..)

    View Slide

  25. TOOL 2:
    POSTMAN

    View Slide

  26. Background
    Started in Sept 2013, raised $1MM May 2015

    Over 3M users (as of June 2016)

    Free but with some paid extensions

    View Slide

  27. Common Commands
    (there really aren’t any - point & click)

    View Slide

  28. Getting Started
    (psst.. open postman)

    View Slide

  29. The Real Power

    View Slide

  30. https://www.getpostman.com/docs

    View Slide

  31. TOOL 3: BDD IRL

    View Slide

  32. Background
    Different from Unit Testing in that we step outside
    the system and take the users’ point of view

    Tools in just about every language:

    Cucumber, Behave, Behat, etc

    Uses the Gherkin syntax

    View Slide

  33. Our Syntax
    It’s English, but in the Gherkin syntax so this:

    As a [role] I want [feature] so that [benefit]

    becomes a feature structured as:

    Given [condition] when I [action] then [result]

    View Slide

  34. Getting Started

    View Slide

  35. http://docs.behat.org/

    View Slide

  36. TOOL 4: FIDDLER

    View Slide

  37. Background
    Created by Telerik, based on .NET (Mono)

    Serves as a local proxy, not a tool for requests

    Free to use; some paid, some free extensions

    Geoedge - route traffic through 130 locations

    View Slide

  38. Common Functionality
    Active Man in the Middle (MITM)

    Logging and Recording

    Traffic & Payload Analysis

    Manipulation/Modification

    Your logs kept locally

    View Slide

  39. View Slide

  40. View Slide

  41. http://www.telerik.com/fiddler
    http://www.telerik.com/fiddler/add-ons

    View Slide

  42. TOOL 5: API TOOLS

    View Slide

  43. Background
    Powered by 3Scale (acquired by Redhat recently)

    Serves as a proxy, not a tool for requests

    Web-based, only good for public APIs

    OSS - local via RPM (or Vagrant or Docker)

    View Slide

  44. Common Functionality
    Active Man in the Middle (MITM)

    Logging and Recording

    Traffic & Payload Analysis

    Manipulation/Modification

    Your logs kept locally (or in the cloud!)

    View Slide

  45. TOOL 6: STOPLIGHT.IO

    View Slide

  46. Background
    Started Dec 2014, still Beta but interesting

    Serves as: a proxy & documentation generator

    Web-based, primarily for public APIs

    Using ngrok, you can share localhost

    View Slide

  47. Common Functionality
    Active Man in the Middle (MITM)

    Logging and Recording

    Traffic & Payload Analysis

    Generates Documentation

    Heavy focus on collaboration & sharing

    View Slide

  48. Getting Started
    (psst.. open stoplight)

    View Slide

  49. https://designer.stoplight.io/docs

    View Slide

  50. TOOL 7:
    RUNSCOPE

    View Slide

  51. Background
    Started in Dec 2012, funded by a16z and others

    Serves as a proxy, performance monitoring, usage
    tracking, unit testing, monitoring, etc

    Web-based, primarily for public APIs

    Using ngrok, you can share localhost

    View Slide

  52. Common Functionality
    Active Man in the Middle (MITM)

    Logging and Recording

    Traffic & Payload Analysis

    Your logs are kept in the cloud

    Incredibly easy to share requests & callbacks

    View Slide

  53. Getting Started
    https://runscope.com

    View Slide

  54. https://runscope.com/docs

    View Slide

  55. To compare…
    Active MITM? Logs? Collaboration?
    Docs
    Generation?
    Testing &
    Validation?
    Fiddler yes local no no no
    API Tools yes internal share results no yes
    Stoplight.io yes local for definitions yes no
    Runscope yes cloud share results no yes

    View Slide

  56. AGENDA
    ASSUMPTIONS
    THE PROBLEMS
    THE STATUS QUO
    THE RIGHT TOOLS

    View Slide

  57. View Slide

  58. View Slide

  59. D. KEITH CASEY JR. @CASEYSOFTWARE
    [email protected]
    BUILDING YOUR
    API UTILITY BELT

    View Slide

  60. Who am I?
    http://TheAPIDesignBook.com

    View Slide