Rest API Architectural Constraints

As we know, Rest is an architectural style, it has some constraints also. In this article we discuss some of the Rest API constraints.

Statelessness: Unlike other services, Rest API is a stateless service. That means, we must treat each request as a separate request. For example, after successful login, saving the session key on the server (or cookie on the browser) is not possible. You have to pass the authorization key as part of each and every request.

Caching: In Rest API, we have to mention explicitly whether each resource is cacheable or not. Rem ember important thing here is, caching in Rest API does not happen at Rest API server. Caching may happen at separate server (between client and Rest API server) or at client side (example: Browser)

Layered System: Client doesn’t know whether it is getting data from end server or from cache server (if caching implements). In this case, it is very difficult to understand whether data getting is latest data or cached data.