A Hypertext Transfer Protocol (HTTP) response is the answer a server gives a client when it has received a request.
A client can be a browser, an application with API access, or a development tool such as Postman.
When the server receives a request, it processes it. Usually, this includes validating the request, processing any data submitted, and then give a proper response. After the server answers the client, the request lifecycle is over.
The contents of the response depend on the request made. If the request was valid, and the client was allowed to make the request, the response will return the requested data. The response will not return any data if authentication fails or if the requested resource does not exist.
Responses include a status code to indicate whether the request was successful. There are many status codes, all grouped into categories.
- 2XX: The request was successful
- 3XX: The request was redirected
- 4XX: The request contained an error from the client.
- 5XX: The request resulted in an error on the server.
GET request will usually have the status code
200. A request made to an endpoint or page that doesn’t exist will result in a
A full list of status codes can be found here.
A response header is a piece of meta-information about the response. A response can have multiple headers. Each header is a key-value pair.
The status code is delivered as a header.