What is a request (request)?
A request is a message that a client sends to a server in order to get data or trigger some action.
The simplest way to put it: a request is the client's "ask" directed at the server.
Why a request is needed
Without a request, the server does nothing. The request is what:
- tells the server what the client needs
- triggers processing on the server
- starts the conversation between the client and the server
In client-server architecture, the client always speaks first.
What a request can contain
In its simple form, a request usually includes:
- what to do (for example: get data, send data, delete a resource)
- what to address (the resource's location on the server)
- additional data (login, password, parameters, the request body)
A real-life example:
"Give me the /profile page for user 123"
A practical example (HTTP)
The most familiar example is the HTTP request:
- a browser requests a web page
- a mobile app requests data from an API
- a program submits a form to the server
Even if a user just opens a website, a request is always happening underneath.
What happens after a request
- The client sends a request
- The server receives it
- The server processes the request
- The server builds a response
- The client receives the response and uses it
A request always implies a response, even if that response is an error.
A real-life analogy
A request is like:
- an order in an online store
- a letter asking for something
- a question asked to a person
You ask first, and only then get an answer.
Short answer for an interview
Remember this phrasing:
A request is a message that a client sends to a server to get data or trigger a specific action. It initiates the interaction in client-server architecture.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.