# HTTP Methods - Overview

### 1\. Introduction to HTTP Methods

* HTTP (Hypertext Transfer Protocol) defines different request methods to interact with a server.
    
* Common HTTP methods: `GET`, `POST`, `PUT`, `PATCH`, and `DELETE`.
    
* Each method serves a specific purpose in data retrieval, modification, or deletion.
    

### 2\. **GET Method**

* Used to request data from a server.
    
* When a user enters a URL in a browser, it sends a `GET` request to fetch the required data.
    
* Example: [`youtube.com/search`](http://youtube.com/search) fetches video results based on the search query.
    
* The server processes the request, retrieves the data from the database, and returns it to the client.
    
* `GET` requests do not modify the server’s data.
    
* Browser's default request method when accessing web pages.
    
* Can be observed using browser developer tools under the “Network” tab.
    

### 3\. **POST Method**

* Used to send data to the server for storage or processing.
    
* Commonly used for forms such as sign-up, login, or feedback submission.
    
* Unlike `GET`, `POST` requests make changes to the server-side database.
    
* Example: When signing up on a social media site, user credentials (username, email, password) are sent to the server using a `POST` request.
    
* Data sent via `POST` is included in the request body rather than the URL, making it more secure than `GET`.
    

### 4\. **PUT Method**

* Used to update or replace existing data on the server.
    
* Requires sending the full updated data payload.
    
* Example: Updating a user profile with new details.
    
* If the resource does not exist, `PUT` may create a new one.
    

### 5\. **PATCH Method**

* Similar to `PUT` but used for partial updates.
    
* Instead of replacing the entire resource, `PATCH` modifies only the specified fields.
    
* Example: Updating a single field like changing a user’s phone number without altering other details.
    

### 6\. **DELETE Method**

* Used to remove a resource from the server.
    
* Example: Deleting a user account or removing a post from a website.
    
* The server processes the request and deletes the specified resource.
    

### 7\. **Conclusion**

* HTTP methods define how a client interacts with a server.
    
* `GET` – Retrieve data.
    
* `POST` – Send new data.
    
* `PUT` – Replace existing data.
    
* `PATCH` – Update specific fields.
    
* `DELETE` – Remove data.
    
* Understanding these methods is crucial for web development and API design.
