the REST-State Story
the REST-State Story
Have you ever heard someone say, “REST is stateless… but my application clearly
has state”?
One of my juniors asked me this last week, and honestly, that confusion is
everywhere in Indian IT teams. So let me explain this in chai‑shop style.
Imagine you go to a five‑star hotel. The waiter remembers you. He knows your
name, your usual drink, even how much sugar you take. That is a stateful system
— the server remembers the client.
Now imagine a roadside chaiwala. He doesn’t remember anyone. Every time you go,
you say:
“Bhaiya, ek cutting chai, kam cheeni.”
That’s REST.
REST means Representational State Transfer. The client sends all required
information with every request. The server has no memory. This is why REST APIs
scale beautifully in cloud environments.
Now let us talk about state, because this is where confusion starts.
There are three types of state in a REST world.
First is Resource State. This is your real business data — customer profiles,
orders, balances, tickets. This lives in databases like Azure SQL, Cosmos DB,
or Oracle. REST APIs use GET, POST, PUT, DELETE to change this state.
Second is Application State. This is the user’s current journey — which page
they are on, what is in their cart, which filters they selected. This state is
stored on the client side, not on the server. The browser or mobile app manages
it and sends only what is needed.
Third is Representation of State. When you call GET /users/1, the server does
not give you a database row. It gives you JSON — a representation of that
state. That is what travels across the network.
Now here comes the Azure and enterprise reality.
In cloud architecture, Application State often means something else — global
shared data for the entire app. Things like feature flags, shared counters,
system configuration, cached reference data. This is not user session. This is
application‑level memory.
In Azure, this is stored properly:
Small static config goes to App Configuration.
Secrets go to Key Vault.
Fast‑changing shared data goes to Redis.
Permanent data goes to Azure SQL or Cosmos DB.
So even though REST servers are stateless, the application as a whole is not
stateless. State is just stored in the right cloud services instead of in
server memory.
That is the secret sauce of cloud‑native systems.
Just like the chaiwala — anyone can serve you as long as you bring your order
every time.
If you enjoyed this explanation, share it with that junior dev who keeps
asking, “Where did my session go?”
