SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
Matt Bishop
 Product Architect at Elastic Path

 Built an e-commerce HATEOAS API
  18-month effort
  20-person dev team
 Transforming Elastic Path from Webapp-centric
 to API-centric
Overview
 (very) short Level 3 definition

 Level 3 Misconceptions

 Developing a Level 3 API
Level 3 REST (L3)
 Links and Types
  Not URLs (the antithesis of L3)
  Not L2++
 Like moving from Assembler to C
  Named variables, not labeled memory addresses
  Methods, not jump tables
  More Who and What, less Where
REST is Mis-acronymed
 Should be REality State Transfer
 “Representations” are an intellectual snag that lead
 too quickly to type systems
 L3 can only succeed when it models the real world
 Most software abstractions take shortcuts:
   Overload abstractions with multiple semantics
   Reuse existing technical abstractions
Example: Products
 What is a Product?
   A Product Manager thinks of a set of options
   A Customer thinks of something to put in their bag


 In reality there is no such thing as a Product
   Item: Something you buy and walk out with
   Offering: Something that holds the possible options that
   lead to specific items
L3 is Hard
 No HATEOAS Frameworks
   All REST frameworks have Resources
   None provide a way to define links between resources

 L3 Clients are difficult to grok
   …but not impossible. Talk to Drewz.
L3 APIs are Rare
 Few Examples in the real world
  “…no real facilities to support HATEOAS, a concept I
  feel is the unicorn of REST. Everyone thinks it’s
  wonderful but no one has ever actually seen it in the
  wild.”
  –Lucis Ferre blogging about WebMachine
Elastic Path’s Unicorn
“L3 is HTTP used
correctly”
 HTTP is a transport protocol

 L3 is an architectural style

 Your server and client should be able to switch
 to a different transport and succeed
“Content-Type is the
Hypermedia Type”
  Content-Type is an HTTP transport header

      application/vnd.com.skynet.cyborg+json

…is just about as right as

      application/com.warnerbrothers.featurefilm+mp4
X-Hypermedia-Type
 Content-Type tells the client how the data is
 serialized, not what type of data it is

 Leave Content-Type to the transport layer

 Put your media type in another header

 Put it in your representation
“Stateless just means
Sessionless”
 L3 requires one Source Of Truth
   Stateless really means completely stateful

   All State persisted in the backend

   …not in the http session, or cookies, or client (duh)

 Not in the query params either!
  GET /search/books?keywords=Fear+Loathing
“Query params should
pass data to a resource”
 Data belongs in the representations, period

 There are no universal business concepts

 Example: pagination

   ?page=2&size=20
   Resource has to understand what this means and
   respond with an appropriate representation
   It also may have different ways of providing pagination
“URIs should have User
IDs in them”
 Humans are not a resource
  They own things like carts and orders and profiles

 Their identity scopes their access

 Authenticate them and pass their identities (and Roles)
 internally

 BTW, anonymous users are people too
Build the Resource Model
 Do NOT try to surface an existing API
  Start with your existing User Interface
  Use physical props
 L3 works best when the resources are modeled
 after the User’s experience of reality

 Do this with a team, achieve unanimity
Basic Heuristics
1. A resource should have one responsibility

2. A resource has very little data and lots of links

3. “Secret Admirer” rule: A resource should not
   know about the resources that link to it
Subresources
 Subresources are rarely useful in L3
   /carts/id/lineitems/id
 Heuristic:
   Is it an inseparable concept for both?
   If no, then make it a separate resource
Connecting to Existing X

                               /totals/carts/27



         /carts/27/lineitems                      /prices/carts/27




    /carts/27
                                Cart                      orders/2/deliveries
                               Service
The Dark Side of Links
 The model is mostly links between resources

 Downside: Chatty Cathy API
  Your framework needs to provide a way to expand
  related rels into a response
Example: Item
                    assets


       add to
        cart                       prices
        form


                    item
       selections                  definition




                    availability
Build the Hypermedia
Controls
 Workflows are a series of state transitions in
 your process
   Add to cart
   Create profile
   Deliver shipment
   Authorize payment
 These transitions are executed via hypermedia
 controls
What’s a Hypermedia
Control?
 A design pattern for interacting with State

 Can be multiple resources providing data and
 actions to the control
   Single entry point into the control
   Numerous links inside the control
Form
The Government got it right
 GET a /form
 Fill it in
 POST it to the action link
Selector
 Like a radio button group or selection list
 Set of links with choices
 Each choice has:
   definition
   action
 POST to action link
Needinfo
 Link to indicate a related resource state is
 incomplete. Interpreted as a transition blocker

 Link points to a control to resolve the state

 Example
   Deliveryinfo required on an order to actually
   deliver an order
Thank You All for a great
RESTFest 2012!

   http://www.elasticpath.com

Más contenido relacionado

Similar a Building an API-centric e-commerce platform

Hypertext2007 Carole Goble Keynote - "The Return of the Prodigal Web"
Hypertext2007 Carole Goble Keynote - "The Return of the Prodigal Web"Hypertext2007 Carole Goble Keynote - "The Return of the Prodigal Web"
Hypertext2007 Carole Goble Keynote - "The Return of the Prodigal Web"hypertext2007
 
From Linked Documentary Resources to Linked Computational Resources
From Linked Documentary Resources to Linked Computational ResourcesFrom Linked Documentary Resources to Linked Computational Resources
From Linked Documentary Resources to Linked Computational ResourcesPhiloWeb
 
Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...
Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...
Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...Tom Hofte
 
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialO'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialTom Hofte
 
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
"Why Fake News Is Relevant" - Introduction to the Userfeeds ProtocolUserfeeds.io
 
Journalism and the Semantic Web
Journalism and the Semantic WebJournalism and the Semantic Web
Journalism and the Semantic WebKurt Cagle
 
Building Self Documenting HTTP APIs with CQRS
Building Self Documenting HTTP APIs with CQRSBuilding Self Documenting HTTP APIs with CQRS
Building Self Documenting HTTP APIs with CQRSDerek Comartin
 
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...apidays
 
Jim Hendler's Presentation at SSSW 2011
Jim Hendler's Presentation at SSSW 2011Jim Hendler's Presentation at SSSW 2011
Jim Hendler's Presentation at SSSW 2011sssw2011
 
Doing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to ProductivityDoing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to Productivityguest3c5c731bc
 
Doing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to ProductivityDoing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to Productivitykevinreiss
 
Gt health2stat 7-22-2010
Gt health2stat 7-22-2010Gt health2stat 7-22-2010
Gt health2stat 7-22-2010George Thomas
 
OrientDB Intro & HTTP REST API Tutorial
OrientDB Intro & HTTP REST API TutorialOrientDB Intro & HTTP REST API Tutorial
OrientDB Intro & HTTP REST API TutorialAnthony Blatner
 
SharePoint Integration and Interoperability - SharePoint Saturday Philly
SharePoint Integration and Interoperability - SharePoint Saturday PhillySharePoint Integration and Interoperability - SharePoint Saturday Philly
SharePoint Integration and Interoperability - SharePoint Saturday PhillyRichard Harbridge
 
The Evolution of Metadata: LinkedIn's Story [Strata NYC 2019]
The Evolution of Metadata: LinkedIn's Story [Strata NYC 2019]The Evolution of Metadata: LinkedIn's Story [Strata NYC 2019]
The Evolution of Metadata: LinkedIn's Story [Strata NYC 2019]Shirshanka Das
 
HATEOAS: The Confusing Bit from REST
HATEOAS: The Confusing Bit from RESTHATEOAS: The Confusing Bit from REST
HATEOAS: The Confusing Bit from RESTelliando dias
 
Introduction to Application Profiles
Introduction to Application ProfilesIntroduction to Application Profiles
Introduction to Application ProfilesDiane Hillmann
 
Online Community Evangelist
Online Community EvangelistOnline Community Evangelist
Online Community EvangelistMarilyn Pratt
 

Similar a Building an API-centric e-commerce platform (20)

Hypertext2007 Carole Goble Keynote - "The Return of the Prodigal Web"
Hypertext2007 Carole Goble Keynote - "The Return of the Prodigal Web"Hypertext2007 Carole Goble Keynote - "The Return of the Prodigal Web"
Hypertext2007 Carole Goble Keynote - "The Return of the Prodigal Web"
 
From Linked Documentary Resources to Linked Computational Resources
From Linked Documentary Resources to Linked Computational ResourcesFrom Linked Documentary Resources to Linked Computational Resources
From Linked Documentary Resources to Linked Computational Resources
 
Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...
Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...
Mind The Gap - Mapping a domain model to a RESTful API - OReilly SACon 2018, ...
 
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialO'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
 
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
 
Journalism and the Semantic Web
Journalism and the Semantic WebJournalism and the Semantic Web
Journalism and the Semantic Web
 
Building Self Documenting HTTP APIs with CQRS
Building Self Documenting HTTP APIs with CQRSBuilding Self Documenting HTTP APIs with CQRS
Building Self Documenting HTTP APIs with CQRS
 
Learning 2.0 for Librarians
Learning 2.0 for LibrariansLearning 2.0 for Librarians
Learning 2.0 for Librarians
 
Modified REST Presentation
Modified REST PresentationModified REST Presentation
Modified REST Presentation
 
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
 
Jim Hendler's Presentation at SSSW 2011
Jim Hendler's Presentation at SSSW 2011Jim Hendler's Presentation at SSSW 2011
Jim Hendler's Presentation at SSSW 2011
 
Doing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to ProductivityDoing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to Productivity
 
Doing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to ProductivityDoing More with Less: Mash Your Way to Productivity
Doing More with Less: Mash Your Way to Productivity
 
Gt health2stat 7-22-2010
Gt health2stat 7-22-2010Gt health2stat 7-22-2010
Gt health2stat 7-22-2010
 
OrientDB Intro & HTTP REST API Tutorial
OrientDB Intro & HTTP REST API TutorialOrientDB Intro & HTTP REST API Tutorial
OrientDB Intro & HTTP REST API Tutorial
 
SharePoint Integration and Interoperability - SharePoint Saturday Philly
SharePoint Integration and Interoperability - SharePoint Saturday PhillySharePoint Integration and Interoperability - SharePoint Saturday Philly
SharePoint Integration and Interoperability - SharePoint Saturday Philly
 
The Evolution of Metadata: LinkedIn's Story [Strata NYC 2019]
The Evolution of Metadata: LinkedIn's Story [Strata NYC 2019]The Evolution of Metadata: LinkedIn's Story [Strata NYC 2019]
The Evolution of Metadata: LinkedIn's Story [Strata NYC 2019]
 
HATEOAS: The Confusing Bit from REST
HATEOAS: The Confusing Bit from RESTHATEOAS: The Confusing Bit from REST
HATEOAS: The Confusing Bit from REST
 
Introduction to Application Profiles
Introduction to Application ProfilesIntroduction to Application Profiles
Introduction to Application Profiles
 
Online Community Evangelist
Online Community EvangelistOnline Community Evangelist
Online Community Evangelist
 

Más de Elastic Path

Evolve 2014 experience driven commerce
Evolve 2014 experience driven commerceEvolve 2014 experience driven commerce
Evolve 2014 experience driven commerceElastic Path
 
Digital Commerce Engine 6.5
Digital Commerce Engine 6.5Digital Commerce Engine 6.5
Digital Commerce Engine 6.5Elastic Path
 
Cashing in on the Smartphone Gaming Boom
Cashing in on the Smartphone Gaming BoomCashing in on the Smartphone Gaming Boom
Cashing in on the Smartphone Gaming BoomElastic Path
 
Moving complex enterprise ecommerce systems to the cloud
Moving complex enterprise ecommerce systems to the cloudMoving complex enterprise ecommerce systems to the cloud
Moving complex enterprise ecommerce systems to the cloudElastic Path
 
Business Challenges Solved by APIs: What Every Executive Should Know
Business Challenges Solved by APIs: What Every Executive Should KnowBusiness Challenges Solved by APIs: What Every Executive Should Know
Business Challenges Solved by APIs: What Every Executive Should KnowElastic Path
 
Keeping customers reducing churn through support and upgrade optimization
Keeping customers reducing churn through support and upgrade optimization Keeping customers reducing churn through support and upgrade optimization
Keeping customers reducing churn through support and upgrade optimization Elastic Path
 
Optimizing the customer journey for the complex sale
Optimizing the customer journey for the complex saleOptimizing the customer journey for the complex sale
Optimizing the customer journey for the complex saleElastic Path
 
Maximizing conversion with checkout optimization
Maximizing conversion with checkout optimizationMaximizing conversion with checkout optimization
Maximizing conversion with checkout optimizationElastic Path
 
The Future of Ecommerce - Web 2.0
The Future of Ecommerce - Web 2.0The Future of Ecommerce - Web 2.0
The Future of Ecommerce - Web 2.0Elastic Path
 
Digital "Elastic" Commerce - Right Here, Right Now - Jump Conference 2011
Digital "Elastic" Commerce - Right Here, Right Now - Jump Conference 2011Digital "Elastic" Commerce - Right Here, Right Now - Jump Conference 2011
Digital "Elastic" Commerce - Right Here, Right Now - Jump Conference 2011Elastic Path
 
Ecommerce and Digital Marketplaces - Planet of the Apps
Ecommerce and Digital Marketplaces - Planet of the AppsEcommerce and Digital Marketplaces - Planet of the Apps
Ecommerce and Digital Marketplaces - Planet of the AppsElastic Path
 
Virtual Goods Mean REAL Money This Holiday
Virtual Goods Mean REAL Money This HolidayVirtual Goods Mean REAL Money This Holiday
Virtual Goods Mean REAL Money This HolidayElastic Path
 
The State of PC Gaming: The Shift from Packaged Goods to Digital Distribution
The State of PC Gaming: The Shift from Packaged Goods to Digital DistributionThe State of PC Gaming: The Shift from Packaged Goods to Digital Distribution
The State of PC Gaming: The Shift from Packaged Goods to Digital DistributionElastic Path
 
The Future of Newspapers and Magazines in the Digital Era
The Future of Newspapers and Magazines in the Digital EraThe Future of Newspapers and Magazines in the Digital Era
The Future of Newspapers and Magazines in the Digital EraElastic Path
 
Consumer Software Buying Trends - Elastic Path Software Research Report
Consumer Software Buying Trends - Elastic Path Software Research ReportConsumer Software Buying Trends - Elastic Path Software Research Report
Consumer Software Buying Trends - Elastic Path Software Research ReportElastic Path
 
Taking Your Site Performance to the Next Level with Optimization Testing
Taking Your Site Performance to the Next Level with Optimization TestingTaking Your Site Performance to the Next Level with Optimization Testing
Taking Your Site Performance to the Next Level with Optimization TestingElastic Path
 
Deliver Successful Enterprise Ecommerce Projects
Deliver Successful Enterprise Ecommerce ProjectsDeliver Successful Enterprise Ecommerce Projects
Deliver Successful Enterprise Ecommerce ProjectsElastic Path
 
Multichannel 2.0: Are You Ready for the Next Generation of Commerce Channels?
Multichannel 2.0: Are You Ready for the Next Generation of Commerce Channels?Multichannel 2.0: Are You Ready for the Next Generation of Commerce Channels?
Multichannel 2.0: Are You Ready for the Next Generation of Commerce Channels?Elastic Path
 
Requirements Diligence: The Cornerstone to Ecommerce Project Success
Requirements Diligence: The Cornerstone to Ecommerce Project SuccessRequirements Diligence: The Cornerstone to Ecommerce Project Success
Requirements Diligence: The Cornerstone to Ecommerce Project SuccessElastic Path
 

Más de Elastic Path (19)

Evolve 2014 experience driven commerce
Evolve 2014 experience driven commerceEvolve 2014 experience driven commerce
Evolve 2014 experience driven commerce
 
Digital Commerce Engine 6.5
Digital Commerce Engine 6.5Digital Commerce Engine 6.5
Digital Commerce Engine 6.5
 
Cashing in on the Smartphone Gaming Boom
Cashing in on the Smartphone Gaming BoomCashing in on the Smartphone Gaming Boom
Cashing in on the Smartphone Gaming Boom
 
Moving complex enterprise ecommerce systems to the cloud
Moving complex enterprise ecommerce systems to the cloudMoving complex enterprise ecommerce systems to the cloud
Moving complex enterprise ecommerce systems to the cloud
 
Business Challenges Solved by APIs: What Every Executive Should Know
Business Challenges Solved by APIs: What Every Executive Should KnowBusiness Challenges Solved by APIs: What Every Executive Should Know
Business Challenges Solved by APIs: What Every Executive Should Know
 
Keeping customers reducing churn through support and upgrade optimization
Keeping customers reducing churn through support and upgrade optimization Keeping customers reducing churn through support and upgrade optimization
Keeping customers reducing churn through support and upgrade optimization
 
Optimizing the customer journey for the complex sale
Optimizing the customer journey for the complex saleOptimizing the customer journey for the complex sale
Optimizing the customer journey for the complex sale
 
Maximizing conversion with checkout optimization
Maximizing conversion with checkout optimizationMaximizing conversion with checkout optimization
Maximizing conversion with checkout optimization
 
The Future of Ecommerce - Web 2.0
The Future of Ecommerce - Web 2.0The Future of Ecommerce - Web 2.0
The Future of Ecommerce - Web 2.0
 
Digital "Elastic" Commerce - Right Here, Right Now - Jump Conference 2011
Digital "Elastic" Commerce - Right Here, Right Now - Jump Conference 2011Digital "Elastic" Commerce - Right Here, Right Now - Jump Conference 2011
Digital "Elastic" Commerce - Right Here, Right Now - Jump Conference 2011
 
Ecommerce and Digital Marketplaces - Planet of the Apps
Ecommerce and Digital Marketplaces - Planet of the AppsEcommerce and Digital Marketplaces - Planet of the Apps
Ecommerce and Digital Marketplaces - Planet of the Apps
 
Virtual Goods Mean REAL Money This Holiday
Virtual Goods Mean REAL Money This HolidayVirtual Goods Mean REAL Money This Holiday
Virtual Goods Mean REAL Money This Holiday
 
The State of PC Gaming: The Shift from Packaged Goods to Digital Distribution
The State of PC Gaming: The Shift from Packaged Goods to Digital DistributionThe State of PC Gaming: The Shift from Packaged Goods to Digital Distribution
The State of PC Gaming: The Shift from Packaged Goods to Digital Distribution
 
The Future of Newspapers and Magazines in the Digital Era
The Future of Newspapers and Magazines in the Digital EraThe Future of Newspapers and Magazines in the Digital Era
The Future of Newspapers and Magazines in the Digital Era
 
Consumer Software Buying Trends - Elastic Path Software Research Report
Consumer Software Buying Trends - Elastic Path Software Research ReportConsumer Software Buying Trends - Elastic Path Software Research Report
Consumer Software Buying Trends - Elastic Path Software Research Report
 
Taking Your Site Performance to the Next Level with Optimization Testing
Taking Your Site Performance to the Next Level with Optimization TestingTaking Your Site Performance to the Next Level with Optimization Testing
Taking Your Site Performance to the Next Level with Optimization Testing
 
Deliver Successful Enterprise Ecommerce Projects
Deliver Successful Enterprise Ecommerce ProjectsDeliver Successful Enterprise Ecommerce Projects
Deliver Successful Enterprise Ecommerce Projects
 
Multichannel 2.0: Are You Ready for the Next Generation of Commerce Channels?
Multichannel 2.0: Are You Ready for the Next Generation of Commerce Channels?Multichannel 2.0: Are You Ready for the Next Generation of Commerce Channels?
Multichannel 2.0: Are You Ready for the Next Generation of Commerce Channels?
 
Requirements Diligence: The Cornerstone to Ecommerce Project Success
Requirements Diligence: The Cornerstone to Ecommerce Project SuccessRequirements Diligence: The Cornerstone to Ecommerce Project Success
Requirements Diligence: The Cornerstone to Ecommerce Project Success
 

Último

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Último (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

Building an API-centric e-commerce platform

  • 1.
  • 2. Matt Bishop Product Architect at Elastic Path Built an e-commerce HATEOAS API 18-month effort 20-person dev team Transforming Elastic Path from Webapp-centric to API-centric
  • 3. Overview (very) short Level 3 definition Level 3 Misconceptions Developing a Level 3 API
  • 4. Level 3 REST (L3) Links and Types Not URLs (the antithesis of L3) Not L2++ Like moving from Assembler to C Named variables, not labeled memory addresses Methods, not jump tables More Who and What, less Where
  • 5. REST is Mis-acronymed Should be REality State Transfer “Representations” are an intellectual snag that lead too quickly to type systems L3 can only succeed when it models the real world Most software abstractions take shortcuts: Overload abstractions with multiple semantics Reuse existing technical abstractions
  • 6. Example: Products What is a Product? A Product Manager thinks of a set of options A Customer thinks of something to put in their bag In reality there is no such thing as a Product Item: Something you buy and walk out with Offering: Something that holds the possible options that lead to specific items
  • 7. L3 is Hard No HATEOAS Frameworks All REST frameworks have Resources None provide a way to define links between resources L3 Clients are difficult to grok …but not impossible. Talk to Drewz.
  • 8. L3 APIs are Rare Few Examples in the real world “…no real facilities to support HATEOAS, a concept I feel is the unicorn of REST. Everyone thinks it’s wonderful but no one has ever actually seen it in the wild.” –Lucis Ferre blogging about WebMachine
  • 10.
  • 11. “L3 is HTTP used correctly” HTTP is a transport protocol L3 is an architectural style Your server and client should be able to switch to a different transport and succeed
  • 12. “Content-Type is the Hypermedia Type” Content-Type is an HTTP transport header application/vnd.com.skynet.cyborg+json …is just about as right as application/com.warnerbrothers.featurefilm+mp4
  • 13. X-Hypermedia-Type Content-Type tells the client how the data is serialized, not what type of data it is Leave Content-Type to the transport layer Put your media type in another header Put it in your representation
  • 14. “Stateless just means Sessionless” L3 requires one Source Of Truth Stateless really means completely stateful All State persisted in the backend …not in the http session, or cookies, or client (duh) Not in the query params either! GET /search/books?keywords=Fear+Loathing
  • 15. “Query params should pass data to a resource” Data belongs in the representations, period There are no universal business concepts Example: pagination ?page=2&size=20 Resource has to understand what this means and respond with an appropriate representation It also may have different ways of providing pagination
  • 16. “URIs should have User IDs in them” Humans are not a resource They own things like carts and orders and profiles Their identity scopes their access Authenticate them and pass their identities (and Roles) internally BTW, anonymous users are people too
  • 17.
  • 18. Build the Resource Model Do NOT try to surface an existing API Start with your existing User Interface Use physical props L3 works best when the resources are modeled after the User’s experience of reality Do this with a team, achieve unanimity
  • 19. Basic Heuristics 1. A resource should have one responsibility 2. A resource has very little data and lots of links 3. “Secret Admirer” rule: A resource should not know about the resources that link to it
  • 20. Subresources Subresources are rarely useful in L3 /carts/id/lineitems/id Heuristic: Is it an inseparable concept for both? If no, then make it a separate resource
  • 21. Connecting to Existing X /totals/carts/27 /carts/27/lineitems /prices/carts/27 /carts/27 Cart orders/2/deliveries Service
  • 22. The Dark Side of Links The model is mostly links between resources Downside: Chatty Cathy API Your framework needs to provide a way to expand related rels into a response
  • 23. Example: Item assets add to cart prices form item selections definition availability
  • 24. Build the Hypermedia Controls Workflows are a series of state transitions in your process Add to cart Create profile Deliver shipment Authorize payment These transitions are executed via hypermedia controls
  • 25. What’s a Hypermedia Control? A design pattern for interacting with State Can be multiple resources providing data and actions to the control Single entry point into the control Numerous links inside the control
  • 26. Form The Government got it right GET a /form Fill it in POST it to the action link
  • 27. Selector Like a radio button group or selection list Set of links with choices Each choice has: definition action POST to action link
  • 28. Needinfo Link to indicate a related resource state is incomplete. Interpreted as a transition blocker Link points to a control to resolve the state Example Deliveryinfo required on an order to actually deliver an order
  • 29. Thank You All for a great RESTFest 2012! http://www.elasticpath.com