tools and techniques for apis

62
API TOOLS AND TECHNIQUES Jason Harmon @jharmn

Upload: jason-harmon

Post on 16-Jul-2015

128 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Tools and techniques for APIs

API TOOLS AND

TECHNIQUESJason Harmon

@jharmn

Page 2: Tools and techniques for APIs

AGENDA

Design Scale

• API specification formats

API Management

Debugging & Testing

• Request/Response capture

• Testing approaches

Analytics

Page 3: Tools and techniques for APIs

SCALEA slightly different look

Page 4: Tools and techniques for APIs

DESIGN SCALE

Problems

• Producing consistent

designs

• Prototyping and rapid

design iteration

• Generate code from

design

• Generate docs from

design

Page 5: Tools and techniques for APIs

API SPECIFICATIONS

• A format to describe operations

• Produced by implementation, or design-first

• Allows for codegen of client or server, as well as

documentation

• Mock APIs with sample responses from spec

• Quick feedback from clients from design-first allows for

rapid iteration

Page 6: Tools and techniques for APIs

HISTORY OF API SPECS

Page 7: Tools and techniques for APIs

API SPECIFICATION

FORMATS• WADL

• WSDL 2.0

• Google Discovery

Document

• IODocs

• Swagger

• Blueprint

• RAML

Page 8: Tools and techniques for APIs

WADL & WSDL 2.0

• 2007: http://www.w3.org/TR/wsdl20/

• 2009: http://www.w3.org/Submission/wadl/

• Neither was ever finalized

• Considered to be largely experimental

artifacts with little adoption

Page 9: Tools and techniques for APIs

GOOGLE DISCOVERY

DOCUMENT• 2010?:

https://developers.google.com/discovery/v1/referen

ce/apis

• Created primarily for discovery (thus the name)

• Still in use at Google

• JSON Schema-based

• Very little adoption

Page 10: Tools and techniques for APIs

IODOCS

• 2011: https://github.com/mashery/iodocs

• OSS project by API management vendor

Mashery

• JSON-Based

• Largely used by customers in the Mashery

ecosystem

Page 11: Tools and techniques for APIs

SWAGGER

• 2011: http://swagger.io/

• OSS by Reverb (https://helloreverb.com/), maker of the Reverb app

• Meant to produce spec from implementation

• Recent additions allow for design-first

• Hyperactive OSS community engagement

• Integrated with many products

• Now in version 2.0

Page 12: Tools and techniques for APIs

BLUEPRINT

• 2013: https://apiblueprint.org/

• Created by Apiary (http://Apiary.io) (an API

portal platform) as standard for their platform

• Markdown-based

• First spec format to switch from code-first to

design-first

Page 13: Tools and techniques for APIs

RAML

• 2013: http://raml.org/

• Created by Mulesoft, a long-standing SOA/ESB/API vendor, as

standard for their platform

• YAML-based

• Design-first

• Resource type definition/traits

• Now in version 2.0

Page 14: Tools and techniques for APIs

CURRENT STATE• Swagger & RAML are in version 2.0

• Swagger is the only player not profiting directly from the spec,

powered through partnerships

• Swagger has an incredible following in the OSS community

• Swagger added design-first later, RAML was design-first up-

front

• RAML seems to be well received by the enterprise community

• Blueprint continues to gain adopters; recent additions of

hypermedia

Page 15: Tools and techniques for APIs

TRENDSDesign-first + Mocking

• Start slow to go fast

• Get API client feedback on

mock APIs

• Real usability is only

measurable with tactile

feedback

• Weakness: multi-scenario

and errors are hard to mock

Page 16: Tools and techniques for APIs

TRENDS

Interactive editors

• Non-JSON formats growing in popularity for readability

• Swagger 1.5 added YAML-based

• RAML is YAML

• Blueprint is Markdown

Page 17: Tools and techniques for APIs

Swagger Editor

Page 18: Tools and techniques for APIs
Page 19: Tools and techniques for APIs

DEVELOPER DEBUGGING

• Figure out why calls aren’t working

• Save calls to make retry simpler

Page 20: Tools and techniques for APIs

POSTMAN

• Loved by developers

• Easy to use locally

• Simple Chrome plugin

• Some limitations in being

from browser

• Not great for sharing within a

team

Page 21: Tools and techniques for APIs

POSTMANAble to create & save requests in collections

Parameterize requests

Import/export collections

Page 22: Tools and techniques for APIs

COMMAND-LINE

Requires no UI

Works on any machine

Save calls as text

cURL is the lingua franca

of APIs

HTTPie is gaining

popularity

http://curl.haxx.se/

HTTPiehttps://github.com/jakubroztocil/httpie

Page 23: Tools and techniques for APIs

CURL - LINGUA

FRANCA

Page 24: Tools and techniques for APIs

CURL - LINGUA

FRANCA

Page 25: Tools and techniques for APIs

CURL - PHP NATIVEAlso batteries included in many other languages

Page 26: Tools and techniques for APIs

DEBUGGING

Request/response capture

• Amazing for developers + support

• Figure out why calls aren’t working

• Often a great setup for testing, from captures

• Implemented by using an HTTP proxy

Page 27: Tools and techniques for APIs

CAPTURE

Consum

erProxy Server

Request

Respons

e

Capture

api.something.comhttps://api-something-com-74776xpbe6nt.runscope.net/

Page 28: Tools and techniques for APIs

CAPTURE IS IN ONE

PLACERunscope bought up just about everything

They’re experts at capture

Page 29: Tools and techniques for APIs

REQUESTB.INYet another “Runscope Community Project”

Page 30: Tools and techniques for APIs

HURL.ITYet another “Runscope Community Project”

Page 31: Tools and techniques for APIs

RUNSCOPESimple to change your hostname to Runscope's

Locally hosted proxy available

Great for debugging webhooks

Page 32: Tools and techniques for APIs

TESTINGAPI tests are about

consumers making calls

Page 33: Tools and techniques for APIs

LOTS OF

DEVELOPMENTAPI testing is still rather cutting edge

Many new options, not many clear picks

Page 34: Tools and techniques for APIs

UNIT TESTING IS NOT

ACCEPTANCE TESTING

Only an API consumer is an effective API test

Page 35: Tools and techniques for APIs

AC IS PROBABLY NOT FROM

PRODUCT MANAGERSThey don’t usually understand APIs

http://apiux.com/2014/02/13/api-product-manager/

Page 36: Tools and techniques for APIs

BALLMER GETS ITAPIs are the developers’ world

Page 37: Tools and techniques for APIs

TESTING TOOLSThere’s no reason to have a buggy API

Work like a craftsman

Page 38: Tools and techniques for APIs

CUCUMBERBehavior Driven Development

http://www.pragmaticapi.com/blog/2013/11/10/bdd-for-apis-talk-at-

apistrat-sf-2013

Page 39: Tools and techniques for APIs

BDD ALTERNATIVESFrisby.js

Page 40: Tools and techniques for APIs

CURL FOR API

TESTINGDeath by a thousand paper cuts

Page 41: Tools and techniques for APIs

RUNSCOPETests derived from proxy/captures

Page 42: Tools and techniques for APIs

SOAPUI (BY

SMARTBEAR)It’s called…SOAP

You can host it completely locally

Page 43: Tools and techniques for APIs

READY API (BY

SMARTBEAR)Private cloud, capture, API virtualization/mocking,

load testing, more

Page 44: Tools and techniques for APIs

ANALYTICSMeasure what you treasure

Page 45: Tools and techniques for APIs

ANALYTICS

Before you do anything:

KPIs for APIs by John Musser

• Formerly of ProgrammableWeb

• Now runs API Science

https://www.youtube.com/watch

?v=UFjgbsRrLHw

http://www.slideshare.net/jmuss

er/kpis-for-apis

Page 46: Tools and techniques for APIs

CALLS…?There’s more to it.

Page 47: Tools and techniques for APIs

MEASUREMENT

OVERLOAD

• Performance, defect rate, stability, support

tickets

• Customer satisfaction/NPS, adoption, churn

• Channel performance, revenue, market

share

Page 48: Tools and techniques for APIs

SLOW

DOWN.

BREATHE.There are a massive

amount of things to

measure

Page 49: Tools and techniques for APIs

DEFINE

YOUR

FUNNELSWhere do you gain value?

Page 50: Tools and techniques for APIs

PLAYERSApp Users

Apps

Developers

Your APIs

Your Company

Page 51: Tools and techniques for APIs

VOLUME IS NOT VALUEHigh call volume doesn’t mean you’re doing it

right

Page 52: Tools and techniques for APIs

MEASURE

INSIDE AND

OUTInternal API metrics are

critical

You may learn things about

your value chain

(see Netflix and LinkedIn)

Page 53: Tools and techniques for APIs

TTFHW“Time to first hello world”

Helps measure Developer Experience (DX)

Page 54: Tools and techniques for APIs

MICROSERVICESOptimize your scale

Scale up where volume calls for it

Page 55: Tools and techniques for APIs

DASHBOARDING

• Think about events

• Analyze funnels

• MongoDB/Couch/etc is

tempting

• Keen.io makes it easier

Page 56: Tools and techniques for APIs

PERFORMANCE METRICS

• API Management Vendors

• All provide this core functionality

• DIY: Often fits into existing metrics

• Mongo/Couch solutions abound

• Often standard web metrics platforms will do the

trick

Page 57: Tools and techniques for APIs

API MANAGEMENT

Page 58: Tools and techniques for APIs

VENDORS

GALORE3Scale

Apigee

Axway/Vordel

CA Technologies

IBM

Mashery/Intel

Mulesoft

SOA Software

WS02

Page 59: Tools and techniques for APIs

MORE

STUFF THAN

YOU THINK

Routing/Provisioning

Packaging

Rate limiting

Event processing

Monitoring

Analytics

Security/Auth

Caching

Geodistribution

Page 60: Tools and techniques for APIs

MORE THAN JUST A

PROXY

Consum

erProxy Server

LOTS

Page 61: Tools and techniques for APIs

TIME TO

MARKETDIY:

• Big investment

• Long timeline

• Ongoing maintenance

• NGINX leading solutions

for proxy aspect

Page 62: Tools and techniques for APIs

THANKS!