title: RESTful websites vs. RESTful APIs - What's the difference and does it matter?
body: <p>I've been reading a lot about REST and how to do REST the "right way". Most resources use terms like RESTful web services or RESTful APIs, however none mention RESTful websites. I am confused by this given that I think of a website and an API as two different things. Yet, when, for example, designing a website using the Rails framework, you're constantly reminded about how RESTful everything is (or is supposed to be). </p>
  
  <p>I get the fact that REST provides a lot of advantages (its architectural properties) for APIs (e.g. a JSON API), but I just don't see how a <strong>website</strong> benefits from being RESTful. As a simple example consider login functionality. In a REST fashion this can be modeled by making a Session model with logging in corresponding to <em>creating</em> a new sesssion, logging out <em>destroying</em> a session and so on. The URLs would look something like this:</p>
  
  <pre><code>Prefix Verb   URI Pattern                    Controller#Action
      new_user_session GET    /users/login(.:format)         sessions#new
          user_session POST   /users/login(.:format)         sessions#create
  destroy_user_session DELETE /users/sign_out(.:format)      sessions#destroy
  </code></pre>
  
  <p>However, these URLs are not very user friendly. From a users point of view it makes more sense to just have a /login path where the login form is displayed. It is also easier to remember. But if we make the URLs map like that they're not really (as) RESTful anymore; does /login identify a resource. If so which one?</p>
  
  <p>Another example is the home page /home or just /. How does that fit into REST? On most websites the home page is a mashup of many different kinds of information and doesn't identify any single resource. For example it could be a page that lists the newest products in a catalog and the last date you logged in; two completely unrelated things. How is that RESTful?</p>
  
  <p>I understand why having a RESTful <strong>API</strong> separate from a website makes sense, but my confusion lies with how REST applies to <strong>websites</strong> - if it even does.</p>