20
HATEOAS APIS Matt Bishop, Product Architect at Elastic Path @MattBishopL3

Hateoas APIs are about relationships

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Hateoas APIs are about relationships

HATEOAS APISMatt Bishop, Product Architect at Elastic Path

@MattBishopL3

Page 2: Hateoas APIs are about relationships

Growth of APIs, How Exciting!

www.elasticpath.com @MattBishopL3

Page 3: Hateoas APIs are about relationships

Actually, it’s more like 14,000

1 minute per API = 6 weeks end-to-end

www.elasticpath.com @MattBishopL3

Page 4: Hateoas APIs are about relationships

REST beats SOAP, How Exciting!

www.elasticpath.com @MattBishopL3

Page 5: Hateoas APIs are about relationships

Growth of Internet Hostnames

www.elasticpath.com @MattBishopL3

Page 6: Hateoas APIs are about relationships

What happened in the 90s?

1989 HTML invented (thanks Tim!) 1992 First browsers built 1994 Netscape launched 1995 Internet Explorer in Win95, IIS

bundled in NT, Apache, PHP released

www.elasticpath.com @MattBishopL3

Page 7: Hateoas APIs are about relationships

Internet Host Names In A Line

www.elasticpath.com @MattBishopL3

Page 8: Hateoas APIs are about relationships

Make a Website, 1995-style

Web sites were coded in:• Java• C / C++• Perl• ColdFusion• Python

www.elasticpath.com @MattBishopL3

Page 9: Hateoas APIs are about relationships

Templates Blew the Doors off the Internet

Late 90s Microsoft ASP, Apache JSP, DreamWeaver, Velocity, etc.

Templates opened internet development to the common man

Templates made data BROWSABLE

www.elasticpath.com @MattBishopL3

Page 10: Hateoas APIs are about relationships

Templates made data browsable

Made linking easy <asp:HyperLink … <a href=“<%= getLink

(somedata) %>

Easy linking means easy browsability

Drives the Network Effect

www.elasticpath.com @MattBishopL3

Page 11: Hateoas APIs are about relationships

APIs are stuck in the 80s

…1987, to be exact (28,174 hosts)

APIs must be browsable before they can be adopted by 100m organizations

100m organizations == your sister’s dress store, my mom’s knitting club

www.elasticpath.com @MattBishopL3

Page 12: Hateoas APIs are about relationships

Comfortably Numb

We can stay stuck here if we don’t link our resources together

www.elasticpath.com @MattBishopL3

Page 13: Hateoas APIs are about relationships

Links are about Relationships Relationships are hard

www.elasticpath.com @MattBishopL3

Page 14: Hateoas APIs are about relationships
Page 15: Hateoas APIs are about relationships
Page 16: Hateoas APIs are about relationships

Relationships are not hard after all

• Relationships are a fundamental part of being an animal

www.elasticpath.com @MattBishopL3

Page 17: Hateoas APIs are about relationships

Relationships make Versionless APIs possible

Relationships are very stable The resources themselves move, but

their relationships do not GET /profiles/id• “addresses”: “/profiles/id/addresses”

? Hmm maybe addresses should be their own resource ?GET /profiles/id• “addresses”: “/addresses”

www.elasticpath.com @MattBishopL3

Page 18: Hateoas APIs are about relationships

Relationships make APIs browsable

Browsable APIs == Browsable data == mass adoption

First step is to make it easy to link

www.elasticpath.com @MattBishopL3

Page 19: Hateoas APIs are about relationships

Cortex API Engine

Elastic Path’s API endeavors have failed four times 2010 drank the HATEOAS Kool-Aid, reset our API

effort Found no frameworks to help past URI-to-method

mapping and ser/deser We built an engine using some existing

technology (Jax-RS, Spring, Shiro) and our own work

Cortex is an API engine that happens to run commerce

www.elasticpath.com @MattBishopL3

Page 20: Hateoas APIs are about relationships

Cortex Design Philosophy

• Small, simple resources written by BAs• Small, simple state changes via controls

• Form• Selector

• “Secret Admirer” rule• All Operations are identified

• REST is the Gestalt, HTTP is a transport

www.elasticpath.com @MattBishopL3