REST

REST stands for REpresentational State Transfer. It's an architectural style for building web services that many developers find easier to use than other options like SOAP or RPC. One of the key benefits of REST is that it uses HTTP, the same protocol that's used to request web pages in a browser, so it's easy to integrate with existing systems.

In a typical REST implementation, each resource is identified by a URL, and the methods used to access the resource (e.g., GET, POST, PUT, DELETE) are defined by the HTTP standard. For example, a service might provide a URL to list all users (e.g., /users) and another URL to retrieve a specific user by id (e.g., /users/123). To create a new user, the service might accept a POST request to the /users URL with the new user data encoded as JSON in the request body. 

Why use REST?

REST has several benefits over other architectures:

  • REST is easy to understand and therefore easy to develop and maintain.
  • REST has good scalability properties thanks to its stateless nature. Stateless means that each request made to the server is an independent transaction that does not depend on or modify any server-side state. This makes it easy to scale REST applications horizontally by adding more servers as needed. 
  • REST APIs are well suited for mobile applications which need to conserve bandwidth and battery life. Mobile devices often have limited resources compared to desktop computers, so making fewer requests that return more data is more efficient for these devices.
  • RESTful APIs are often easier to parse and consume than other types of APIs thanks to their well-defined structure. Most programming languages have libraries that make it easy to work with JSON, the format most often used by RESTful APIs. 

Why is REST Important in System Design Interviews?

System design interviews often involve designing web services, and many interviewers will give candidates the choice of using either REST or another architecture like SOAP or RPC. REST also has some advantages over other architectures when it comes to scalability and performance. For example, because REST uses HTTP caching mechanisms like ETags and Last-Modified headers, it can more easily take advantage of browser caching to improve performance. Additionally, because each resource is identified by a URL, resources can be easily load-balanced across multiple servers without requiring any changes to client code.