Download - Hateoas APIs are about relationships
HATEOAS APISMatt Bishop, Product Architect at Elastic Path
@MattBishopL3
Actually, it’s more like 14,000
1 minute per API = 6 weeks end-to-end
www.elasticpath.com @MattBishopL3
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
Make a Website, 1995-style
Web sites were coded in:• Java• C / C++• Perl• ColdFusion• Python
www.elasticpath.com @MattBishopL3
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
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
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
Comfortably Numb
We can stay stuck here if we don’t link our resources together
www.elasticpath.com @MattBishopL3
Links are about Relationships Relationships are hard
www.elasticpath.com @MattBishopL3
Relationships are not hard after all
• Relationships are a fundamental part of being an animal
www.elasticpath.com @MattBishopL3
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
Relationships make APIs browsable
Browsable APIs == Browsable data == mass adoption
First step is to make it easy to link
www.elasticpath.com @MattBishopL3
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
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