resting in the alps mike amundsen's presentation from qcon london 2013

166
RESTing in the ALPS Generic Hypermedia and Domain-Specific APIs @mamund Mike Amundsen Principal API Architect, Layer 7 Technologies

Upload: ca-api-management

Post on 21-May-2015

2.408 views

Category:

Technology


1 download

DESCRIPTION

Generic Hypermedia and Domain-Specific APIs: RESTing in the ALPS Track: Building Web APIs: Opening & Linking your Data / Time: Thursday 15:40 - 16:30 / Location: Fleming Room Hypermedia API is the new catch-phrase, but what is a Hypermedia API? Does this trend lead us toward a debilitating explosion of media types? Can we really create successful hypermedia APIs or is this just the latest hype? Recently a number of new media types that offer hypermedia support have come into use on the Web including HAL, Collection+JSON, Siren, and more. However, these new designs are not designed to communicate application-specific information (e.g. accounting, microblogging, etc.) in a standard way. Is there a way to resolve this problem? Drawing on the experience of Dublin Core, Microformats, Activity Streams, and other similar approaches, this talk describes the ALPS (Application-Level Profile Semantics) standard; a way to define the data and workflow details for a Web application and apply these details consistently regardless of the media type in use. Working examples in the talk also show how this standardized definition can make designing, implementing, documenting, and maintaining Web APIs easier and more consistent across multiple media types.

TRANSCRIPT

Page 1: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

RESTing in the ALPSGeneric Hypermedia and Domain-Specific

APIs

@mamundMike Amundsen

Principal API Architect, Layer 7 Technologies

Page 2: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

A simple story In three parts...

Page 3: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The bona fidesHow we got here...

Page 4: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confessionI left some stuff out...

Page 5: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Where I make amendsThe payoff

Page 6: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Ok, let's begin...

Page 7: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

How we got here...The bona fides

Page 8: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Let's start with a quote from 2002

Page 9: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Fielding and Taylor, 2002

"REST provides [this] by focusing on a shared understanding

of data types with metadata..."

Page 10: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

That phrase struck me.

Page 11: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

It has become a prime motivator for me.

Page 12: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

focusing

Page 13: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

focusingon

Page 14: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

focusingon

shared understanding

Page 15: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

shared understanding

Page 16: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

How do we share understanding on the Web?

Page 17: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

protocols

Page 18: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

protocols

httpftp

smtpdns

ws xmpp

Page 19: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

But that's not all...

Page 20: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Fielding & Taylor, 2002

"REST components communicate by transferring a representation of the data

in a format matching one of an evolving set of standard data types..."

Page 21: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

standard data types

htmlcsv

halatom

json Cj

Page 22: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

registered media types

htmlcsv

halatom

json Cj

Page 23: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

messages

htmlcsv

halatom

json Cj

Page 24: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

We share understanding via messages.

Page 25: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Description

Page 26: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Discovery

Page 27: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Hypermedia

Page 28: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

These messages tell us what protocol actions are possible.

Page 29: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

These messages tell us what protocol actions are possible.

Page 30: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

How is this done in a message?

Page 31: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

affordances

Page 32: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

hypermediaaffordances

Page 33: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

protocolhypermediaaffordances

Page 34: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Back in 2010, I called those...

Page 35: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 36: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 37: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Identify nine features for sharing understanding about protocol actions.

Page 38: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 39: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 40: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 41: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Identify the affordances

Page 42: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 43: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Categorize them.

Page 44: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 45: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

For lots of media type designs.

Page 46: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 47: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 48: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 49: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 50: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

This gives us a tool for lots of tasks...

Page 51: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

We can analyze existing designs

Page 52: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

We can categorize types for 'best fit' implementations

Page 53: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

We can use H-Factors to model prototype designs

Page 54: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 55: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

We now have a shared understanding

about protocol affordances

Page 56: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 57: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 58: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

And this is all good.

Page 59: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

But...

Page 60: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

There's a problem here.

Page 61: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

An important piece is missing.

Page 62: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

There is a "gap" between theory and practice

Page 63: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

There is a "gap" between H-Factors and "the real world"

Page 64: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

I ignored this "gap" when identifying H-Factors.

Page 65: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

I side-stepped the "gap" in the last book.

Page 66: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Page 67: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

And this "gap" is a key theme in the next book.

Page 68: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

H-Factors

Yep, you might say...

Page 69: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

I left some stuff out.The confession

Page 70: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

I ignored the "hard" parts ...

Page 71: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

Page 72: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

What are those?

Page 73: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

Page 74: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

They're rather specific.

Page 75: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

Page 76: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

affordances?

Page 77: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

Page 78: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

Well, they are not protocol affordances

Page 79: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

I call them application affordances

Page 80: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The confession

But there is another name for these...

Page 81: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

VocabulariesSrsly?

Page 82: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

On the Web, representations contain

protocol AND application affordances

Page 83: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

We share understandingat the application-level, too.

Page 84: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

Well, "we" means us humans.

Page 85: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

Do we share app-level understanding?

Page 86: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

How about now?

Page 87: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

How about now?

Page 88: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

Human app-level affordances

Page 89: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

Machine app-level affordances

Page 90: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

Of course, we've known this for quite a while.

Page 91: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

There has been quite a bit of work on vocabularies

dublin core

microformatsactivity streams

schema.org

VoID

Page 92: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

Vocabularies can provide shared understanding

of the application-specific affordances

Page 93: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

And this is all good.

Page 94: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

But...

Page 95: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

There's a problem here.

Page 96: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

An important piece is missing.

Page 97: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

There is a "gap" between theory and practice

Page 98: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

There is a "gap" between Vocabularies and "the real world"

Page 99: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

Vocabularies only model the "what"

state

Page 100: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

Vocabularies only model the "what"

not the "how"

state

transitions

Page 101: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

I know what a Person is, but how can I interact with it?

Page 102: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

I know what an hProduct is, but how can I interact with it?

Page 103: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Vocabularies

I know what an ActivityStream is, but how can I interact with it?

Page 104: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoffWhere I make amends

Page 105: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

What if we combined the "what" of vocabularies

state

Page 106: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

What if we combined the "what" of vocabularies

withthe "how" of protocols?

state

transitions

Page 107: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

What would that look like?

state

transitions

Page 108: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

XHTML Meta Data Profiles (XMDP)Tantek Celik, 2003

Page 109: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

A few years on, a similar approach...

Page 110: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

ALPS - Microblogging with XHTMLMike Amundsen, 2011

Page 111: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

ALPS includes both state and transitions

Page 112: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

ALPS(mb) hackathon at 2011 RESTFest.

Initial experiment was a success.Independently built apps could interop.

Page 113: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

Microblogging site rstatus implements ALPS(mb) in 2012

Page 114: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

ALPS(mb) was a good ideabut we can do better.

Page 115: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

The payoff

How about a profile specthat includes both

state and transitionsthat works for a wide range

of media types?

Page 116: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Application-Level Profile Semantics

The sequel

Page 117: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Warning!What follows is early-stage,

tentative design

Page 118: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Design and register two media types for describing problem domains.

application/alps+xml (or +json)

Page 119: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 120: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 121: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 122: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 123: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Four possible descriptor types:1. semantic (data)2. safe (HTTP.GET)3. unsafe (HTTP.POST)4. idempotent (HTTP.PUT & HTTP.DELETE)

Page 124: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 125: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

ALPS 'id' properties become representation identifiers● @class, @rel, @name (HTML)● @rel, @name (Cj, HAL)● @rel (Atom)

Page 126: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Apply these semantics to a wide range of existing media types

Page 127: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 128: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

There will be a set of rules for applying ALPS semantics

to each media type.

Page 129: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 130: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

By applying semantic descriptors consistently...

Page 131: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 132: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

selecting an implementation media type

can be independent of the state and transition

semantics.

Page 133: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 134: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

selecting a reference vocabularycan be independent of the

protocol semantics

Page 135: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Page 136: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

ALPS spec will provide several markup elements

Page 137: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Now we have a way to share understanding

Page 138: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Now we have a way to share understandingabout a problem domain

Page 139: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Now we have a way to share understandingabout a problem domain

Not a service document (WSDL)

Page 140: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Now we have a way to share understandingabout a problem domain

Not a discovery document (Google, @mnot)

Page 141: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Now we have a way to share understandingabout a problem domain

Not a hypermedia type (HAL, Cj, Siren, etc.)

Page 142: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Now we have a way to share understandingabout a problem domain

Not a vocabulary repository

Page 143: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Now we have a way to share understandingabout a problem domain

Not an object graph

Page 144: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

This could give us tools for lots of tasks...

Page 145: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Describing a domain profile

Page 146: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Analyzing domain profiles

Page 147: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Matching domain profiles to media types

Page 148: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Sharing selected state with multiple services

schema.org/Persongift lists

contacts

photosancestry tree

matchmaker

school pals

Page 149: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Documenting domain profiles

Page 150: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Driving server-side representation engines

Page 151: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Driving client-side processing engines

Page 152: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

ALPS

Possible benefits of ALPS Repositories:● Share your domain profiles● Search for profiles by topic● Match abstracts w/ favored vocabularies● Reflect aggregate profile use/reference data

Page 153: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

So, where are we headed now?

Summary

Page 154: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Snowflakes still commonprogrammableWeb, 2012

Summary

Page 155: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

How many data types here?programmableWeb, 2012

Summary

Page 156: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

How much shared understanding here?programmableWeb, 2012

Summary

Page 157: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Fielding & Taylor, 2002

"REST components communicate by transferring a representation of the data

in a format matching one of an evolving set of standard data types..."

Page 158: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

standard data types includes both

state and transition types

Summary

Page 159: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

shared understanding includes both

state and transition types

Summary

Page 160: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

because the Web includes both

state and transition types

Summary

Page 161: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

protocols

httpftp

smtpdns

ws xmpp

Page 162: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

media types

htmlcsv

halatom

json Cj

Page 163: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

dublin core

microformatsactivity streams

schema.org

VoIDvocabularies

Page 164: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

micro-blogging

hProductPerson

vCard

accounting

domain profiles

Page 165: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

Summary

● ALPS IETF I-D will be posted in March● Watch my blog/twitter for details● Looking for feedback/contributions

Page 166: RESTing in the ALPS Mike Amundsen's Presentation from QCon London 2013

RESTing in the ALPSGeneric Hypermedia and Domain-Specific

APIs

@mamundMike Amundsen

Principal API Architect, Layer 7 Technologies

Let's talk!