Home » Application & Resource State

Application & Resource State

Application State and Resource State are often confused. They are completely different things. Lets try to define them in REST APIs context.

Application State:
the client maintains application state (stateless);
application state is kept on the client, but the server can manipulate it by sending representations (via hypermdia) that describe the possible state transitions.
scalability: stateless includes scalability: new nodes can be added (or disabled ) for processing and setting up the load balancer at any time, no server state needs to be migrated to the new nodes;
caching: a stateless API is also easy to cache as well since caching is done on the client side;
extrinsic: in a client–server interaction, state is made up of intrinsic state and extrinsic state.  Extrinsic state, called application state, is stored on each client and consists of information that is dependend on the server’s context and therefore cannot be shared. Clients are responsible for passing application state to the server when it needs it. The constraint of storing application state on the client rather than on the server makes the communication stateless;
Resource State:
the server maintains resource state;
resource state is kept on the server, but the client can manipulate it by sending the server a representation describing the desired new state.
is the current state of a resource on a server at any point of time – and it has nothing to do with the interaction between client and server. It is what you get as a response from the server as API response. You refer to it as resource representation aka REST;
intrinsic state, called resource state, is stored on the server and consists of information that is independent of the server’s context, thereby making it sharable to all clients of the server;
State Machine:
is a concept within computer programming that is used to describe a machine that has a set of states, usually with input and output events;


State Application and resource state
Ruben Verborgh https://ruben.verborgh.org/blog/2012/08/24/rest-wheres-my-state/
Stackoverflow https://stackoverflow.com/questions/27054277/how-to-distinguish-application-state-and-resource-state
SymfonyCasts https://symfonycasts.com/screencast/rest/client-state
O’Reilly – RESTful Webservices http://restfulwebapis.com/RESTful_Web_Services/#calibre_link-1645
O’Reilly – RESTful Web APIs https://restapilinks.com/wp-content/uploads/2021/04/RESTful_Web_APIs.pdf (p.10-13)
   
State State Machine
Nordic APIs https://nordicapis.com/designing-a-true-rest-state-machine/