REST: a definition
I was recently asked in a technical interview to define REST. While I’ve consumed and even set up my own REST APIs, I struggled for a concise response.
Here’s what my response would be given some thought.
REST stands for “representational state transfer.” It is an architecture style used on the World Wide Web that features:
client-server separation - each acts independently of the other: a client does not store data and a server does not care about user interactions or state
stateless - each API request/response of data is independent; no additional information is stored
cacheable - responses can be cached to improve performance, eliminating most client-server interactions
uniform interface - there is a common setup for consuming an API featuring a base URL (ex, http://www.phxilap.com/api/), an HTTP request such as GET, POST, PUT, DELETE, etc., and MIME type identifying the file type (ex. json, pdf, html, etc).