-
Notifications
You must be signed in to change notification settings - Fork 1
Http Request And Responses
Here we will be learning about basic GET and POST requests, understanding APIs and using Postman.
The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers.
HTTP works as a request-response protocol between a client and a server.
A web browser may be the client, and an application on a computer that hosts a web site may be the server.
Example: A client (browser) submits an HTTP request to the server; then the server returns a response to the client. The response contains status information about the request and may also contain the requested content.
- GET
- POST
- PUT
- HEAD
- DELETE
- PATCH
- OPTIONS
We will be dealing only with GET and POST methods.
The GET methods are used to receive a response from a server or API.
The POST method is used to submit an entry to a server, which results in a change in state.
An HTTP request is made by a client, to a named host, which is located on a server. The aim of the request is to access a resource on the server.
To make the request, the client uses components of a URL (Uniform Resource Locator), which includes the information needed to access the resource. The components of a URL explains URLs.
A correctly composed HTTP request contains the following elements:
- A request line.
- A series of HTTP headers, or header fields.
- A message body, if needed.
Read about HTTP requests in detail
HTTP Response is the packet of information sent by Server to the Client in response to an earlier Request made by Client. HTTP Response contains the information requested by the Client.
An HTTP response contains:
- A status line.
- A series of HTTP headers, or header fields.
- A message body, which is usually needed.