Building your API utility belt (Keith Casey)

53
BUILDING YOUR API UTILITY BELT D. KEITH CASEY, JR AUSTIN, TX [email protected] @CASEYSOFTWARE

Transcript of Building your API utility belt (Keith Casey)

BUILDING YOUR API UTILITY BELTD. KEITH CASEY, JR AUSTIN, TX [email protected] @CASEYSOFTWARE

The API for Audio & Video Data

http://TheAPIDesignBook.com

ASSUMPTIONS !THE PROBLEMS THE STATUS QUO THE RIGHT TOOLS

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.

ASSUMPTIONS

Assumption:

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

Assumption:

Nothing is perfect

You make mistakes

Your providers make mistakes

That other team are knuckleheads

Assumption:You acknowledge the real Batman

Ben Affleck

Christian Bale

George Clooney

Val Kilmer

Michael Keaton

Assumption:You acknowledge the real Batman

Ben Affleck

Christian Bale

George Clooney

Val Kilmer

Michael Keaton

Assumption:You acknowledge the real Batman

Ben Affleck

Christian Bale

George Clooney

Val Kilmer

Michael Keaton

TOOL 1: CURL

curl / libcurl

Completely open source with tons of integrations

Incredible power and flexibility

Incredible complexitiy

Common curl Parameters

-X specify an HTTP verb

-d specify data fields, such as for a POST

-I return/display all the included headers

-H add extra/custom headers

Getting Started

curl https://api.github.com

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

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

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

Full docs (35 pages!)

http://curl.haxx.se/docs/manual.html

TOOL 2: POSTMAN

Background

Started September 2013, raised $1MM May 2015

Over 1.5M users, 800k are active

Chrome Plugin - free, but has paid extensions

Common Commands

(there really aren’t any - point & click!)

Getting Started

curl https://api.github.com

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

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

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

The Real Power

Full docs

https://www.getpostman.com/docs

TOOL 3: BDD IRL

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

Catch my talk “Is your API Misbehaving”

Our Syntax

It’s English, but in the Gherkin syntax so this:

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

becomes a feature called:

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

An example

TOOL 4: FIDDLER

Background

Created by Telerik, based on .Net (Mono)

Serves as a local proxy, not a tool for requests, etc

Free to use; some paid, some free extensions

Geoedge - route traffic through 130 locations

Common Functionality

Active Man In The Middle (MITM)

Logging and Recording

Traffic & Payload Analysis

Manipulation

Your logs are kept locally

Full docs

http://docs.telerik.com/fiddler

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

TOOL 5: APITOOLS

Background

Powered by 3Scale

Serves as a proxy, not a tool for requests

Web-based, only good for public APIs

Local Debian (or Vagrant or Docker) - OSS

Common FunctionalityActive MITM FTW!

Logging and Recording

Traffic & Payload Analysis

Manipulation

Your logs are kept:

In the cloud or locally, your choice!

In Action

https://www.apitools.com/slugs

Full docs

https://docs.apitools.com/docs/

But seriously.. it’s really only 2 steps.

TOOL 6: STOPLIGHT.IO

Background

Started Dec 2014, still Beta but interesting

Serves as: a proxy and documentation generator

Web-based, primarily for public APIs

Using ngrok, you can share localhost

Common Functionality

Active MITM FTW!

Logging and Recording

Traffic & Payload Analysis

Generates Documentation

Heavy focus on collaboration & sharing

In Action

https://dash.stoplight.io/apps

Full docs

???

TOOL 7: RUNSCOPE

Background

Started Dec 2012, well-funded by a16z and others

Serves as: a proxy, performance monitoring, unit test, usage tracking, API monitoring

Web-based, primarily for public APIs

Using Passageway, you can share localhost

Common Functionality

Active MITM FTW!

Logging and Recording

Traffic & Payload Analysis

Your logs are kept in the cloud

Incredibly easy to share requests & callbacks

In Action

https://www.runscope.com/

Full docs

https://www.runscope.com/docs

ASSUMPTIONS !THE PROBLEMS THE STATUS QUO THE RIGHT TOOLS

BUILDING YOUR API UTILITY BELTD. KEITH CASEY, JR AUSTIN, TX [email protected] @CASEYSOFTWARE

http://TheAPIDesignBook.com