I know it might be a dumb question or this is the right question to ask.
aren't we always doing such kinds of things with simple web without REST API? The client-side (browser) will make a request, then the server will response. So why do we need REST?
The simple web IS a REST API.
Which is to say, REST is an architectural style. The reference application is the world wide web itself.
The fact that you can use a web browser to
- Post questions on stackexchange
- Watch cat videos
- Update the configuration of your router
- Shop for books
- Bet on sports
And so on is all a reflection of the fact that we have a limited and well specified assortment of domain agnostic messages that we can pass around.
Here's a key idea, that may help
REST is intended for long-lived network-based applications that span multiple organizations.
The web works because Mozilla, Apache, Google, Microsoft, and so on all follow a bunch of publicly available standards.
Over the last thirty years, this has turned out to be a really effective way to build distributed information systems with human consumers.
For example, thirty years ago, to ask this question you would be on some bulletin board system or perhaps an NNTP client. The arrival of the web was a mass extinction event for a number of information systems.
But... while creating a website for human beings is (relatively) well understood, creating websites for machines is different. We don't need to worry about presentation, so we can use media-types with more efficient sizing/parsing, but we also need to be able to train the machines to extract the domain semantics from the messages, which is hard.