Websites and RESTful APIs are nothing but a builder pattern.

Luke Puplett
Luke Puplett’s Personal Blog
1 min readMar 22, 2019

When you think about it, a stateless web workflow is simply guiding the consumer through forming an HTTP request.

If the task at hand is to add a book to our Amazon shopping cart, then no mutation to persistent state occurs until we click the add button — all the steps leading up to that action are stateless and are merely serving to build the correct form that leads to the correct HTTP request.

The key word here is correct. The website is designed in such a way as to ensure the shopper cannot get it wrong. By following the links and using the controls on the pages, its impossible to misuse the website. If it were possible, then that would be a defect and the product team would fix it.

The intermediate steps are building request upon request where the page or the hyperlinks on the page are layering-up more and more state to use in the preparation the next link or form. In HTML, forms have hidden fields which are a crucial part of this stateless builder pattern.

This is why there’s no such thing as a RESTful URL. With a hypermedia API, the URL is just an implementation detail, it may contain a stack of parameters accumulated from previous choices.

And this is why website developers don’t talk about endpoints and why when REST API developers use the term they’re probably thinking about it all wrong.

--

--

Luke Puplett
Luke Puplett’s Personal Blog

Zipwire - time journalling, approval and pay built by techies for techies - https://zipwire.io