Consuming REST APIs for all interpretations of REST

50

Transcript of Consuming REST APIs for all interpretations of REST

Page 1: Consuming REST APIs for all interpretations of REST
Page 2: Consuming REST APIs for all interpretations of REST

CONSUMING REST APISFOR ALL INTERPRETATIONS OF REST

@darrel_miller

Page 3: Consuming REST APIs for all interpretations of REST
Page 4: Consuming REST APIs for all interpretations of REST
Page 5: Consuming REST APIs for all interpretations of REST
Page 6: Consuming REST APIs for all interpretations of REST

203Non Authoritative

Page 7: Consuming REST APIs for all interpretations of REST

TODAY’S MENU

API Economy

Client SDKs

Appetizers

Main Course

Dessert

Interpretations of REST

Change is inevitable and good

Code reuse on the web

The secret of REST clients

Samples and Libraries to explore

Page 8: Consuming REST APIs for all interpretations of REST

API ECONOMY

Page 9: Consuming REST APIs for all interpretations of REST

HIDING THE GOODNESS

Page 10: Consuming REST APIs for all interpretations of REST

QUALITY + QUANTITY = $$$

Page 11: Consuming REST APIs for all interpretations of REST

CONTROL IS CRITICAL

Page 12: Consuming REST APIs for all interpretations of REST

DON’T ASSUME THE PROVIDED SDK IS THE BEST OPTION

CHEF’S SUGGESTION

UNDERSTAND YOUR DEPLOYMENT CONSTRAINTS

Page 13: Consuming REST APIs for all interpretations of REST

WHAT DO YOU MEAN BY REST?

Page 14: Consuming REST APIs for all interpretations of REST

DESIRED EFFECT?

Page 15: Consuming REST APIs for all interpretations of REST

DESIRED EFFECT?

Client/ServerStatelessCachingUniform InterfaceLayeredCode On Demand

ScalableEvolvableFault TolerantComposable

Page 16: Consuming REST APIs for all interpretations of REST

JSON-REST TASTES GREAT…

PoutineQuick and Easy

Warning : Long term consumption may be detrimental to your health

Page 17: Consuming REST APIs for all interpretations of REST

ADD SOME HYPERMEDIA

Page 18: Consuming REST APIs for all interpretations of REST

APIS DONE OUR WAY

application/vnd.github.v3+json

application/vnd.heroku+json; version=3

Page 19: Consuming REST APIs for all interpretations of REST

GENERIC HYPERMEDIA

JSON-LD

Uber

HALMason Siren

Hyper-Schema

Json-api

Page 20: Consuming REST APIs for all interpretations of REST

UNDERSTAND THE PURPOSE OF MEDIA TYPES

CHEF’S SUGGESTION

BE AWARE OF THE EFFECTS OF YOUR DESIGN CHOICES

Page 21: Consuming REST APIs for all interpretations of REST

DATA ORIENTED APIS

Page 22: Consuming REST APIs for all interpretations of REST

SCENARIO BASED APIS

Page 23: Consuming REST APIs for all interpretations of REST

HYPERMEDIA DRIVEN RITUALS

Page 24: Consuming REST APIs for all interpretations of REST

DATA ORIENTED APIS ARE GREAT FOR QUICK, EASY AND INTERNAL OR GOVERNMENT DATA

CHEF’S SUGGESTION

SCENARIO ORIENTED IF YOU WANT TO MAKE MONEY

Page 25: Consuming REST APIs for all interpretations of REST

CHANGE IS GOOD

Page 26: Consuming REST APIs for all interpretations of REST

START SMALL, EVOLVE QUICKLY

Page 27: Consuming REST APIs for all interpretations of REST

START SMALL, EVOLVE QUICKLY

Page 28: Consuming REST APIs for all interpretations of REST

START SMALL, EVOLVE QUICKLY

Page 29: Consuming REST APIs for all interpretations of REST

VERSIONING HURTS

Page 30: Consuming REST APIs for all interpretations of REST

A LITTLE PARANOIA CAN BE USEFUL

Page 31: Consuming REST APIs for all interpretations of REST

CHANGE IS GOOD

CHEF’S SUGGESTION

VERSION AS A LAST RESORT

Page 32: Consuming REST APIs for all interpretations of REST

SOFTWARE’S HOLY GRAIL

Achieving reuse on the web is different…

Page 33: Consuming REST APIs for all interpretations of REST

API REUSE VERSUS WEB REUSE

Page 34: Consuming REST APIs for all interpretations of REST

IGNORANCE IS BLISS

Page 35: Consuming REST APIs for all interpretations of REST

REUSABLE COMPONENTS

Page 36: Consuming REST APIs for all interpretations of REST

MAYBE ONE DAY…

Page 37: Consuming REST APIs for all interpretations of REST

BEWARE MEDIA TYPE EXPLOSION

Page 38: Consuming REST APIs for all interpretations of REST

SUPPORT MULTIPLE MEDIA TYPES

Page 39: Consuming REST APIs for all interpretations of REST

CONSIDER HYPERMEDIA TO ENABLE CLIENT CODE REUSE

CHEF’S SUGGESTION

UNDERSTAND THE CONTRACTS YOU ARE USING

Page 40: Consuming REST APIs for all interpretations of REST

THE SECRET OF REST CLIENTS

Client code dictates coupling

Page 41: Consuming REST APIs for all interpretations of REST

BREAKING REQUEST FROM RESPONSE

Create Request

Process Request

Handle Response

Page 42: Consuming REST APIs for all interpretations of REST

CENTRALIZED RESPONSE HANDLING

Create Request

Process Request

HTTP Response Machine

Page 43: Consuming REST APIs for all interpretations of REST

CONTEXT IS KING

Process Request

HTTP Response Machine

Dispatch on : Status Code Media Type Link Relation Type

Page 44: Consuming REST APIs for all interpretations of REST

CLIENT STATE MANAGEMENT

Page 45: Consuming REST APIs for all interpretations of REST

CLIENT STATE MANAGEMENT

Create Request

Process Request

HTTP Response Machine

Client State Model

Client View

ApplicationController

Page 46: Consuming REST APIs for all interpretations of REST

BREAKING REQUEST/RESPONSE COUPLING BRINGS FLEXIBILITY

CHEF’S SUGGESTION

LINK RELATION TYPES ARE YOUR FRIEND

APPLY RESPONSES TO TRANSFORM CLIENT STATE

Page 47: Consuming REST APIs for all interpretations of REST

Using Hypermedia to avoid the app store – https://www.youtube.com/watch?v=LbSM8U21YkM

Crafting Evolvable API Representations –https://vimeo.com/131643022

Succeeding In Failing – https://vimeo.com/131632607

Dot Net Fringe - ???

RELATED TALKS

Page 48: Consuming REST APIs for all interpretations of REST

LIBRARIES

http://github.com/tavis-softwareTavis.UriTemplatesTavis.LinkTavis.HomeTavis.ProblemTavis.JsonPatch

Tavis.HttpCacheTavis.AuthTavis.JsonPointerTavis.HalTavis.Status

http://hapikit.github.ioHapikit.netHapikit.pyHapikit.go…

Tooling for building better HTTP API Client Libraries

Page 49: Consuming REST APIs for all interpretations of REST

SAMPLES

https://github.com/Runscope/dotnet-webpack

https://github.com/hapikit/github.net.hapikit

https://github.com/darrelmiller/ForceLinksForNet

https://github.com/hapikit/stormpath.net.hapikit

https://github.com/hapikit/haveibeenpwnd.net.hapikit

Page 50: Consuming REST APIs for all interpretations of REST

BON APPETIT

Twitter: @darrel_miller

http://www.bizcoder.com/