HTTP (Hypertext Transfer Protocol) defines several methods also referred to as HTTP which indicate the desired action to be performed on a resource. Here is the list of some of the most commonly used HTTP methods:
1. GET
2. POST
3. HEAD
4. PUT
5. DELETE
6. PATCH
7. OPTIONS
8. TRACE
1. GET
The GET method is used to request data or information from the given server using a given URI. GET method is used to only retrieve the data from the server and it should have no other effect on the data.
Example
2. POST
POST request is used to send data from the user to the server. This is often used when a user submits a form on the web page. For example, student registration, customer information, file upload, etc. using HTML forms.
Example
3. HEAD
The HEAD method is same as GET, but it is used to request only status line and header section without the actual body content. In other words it's request to identical to a GET request but without the response body.
Example
4. PUT
The PUT method is used to update the already existing resource or to create a new resource if it does not exist at a specified URL. In the other words, PUT method replaces all current the representations of the target resource with new uploaded content.
Example
5. DELETE
The DELETE HTTP Method is used to request the deletion of a resource at a specified URL. This method is used when the client wants to delete a resource on the server.
Example
6. PATCH
This HTTP method is used to apply partial modifications to a resource. The PATCH method is typically used for updating a resource with only the changes provided in the request.
Example
7. OPTIONS
The OPTIONS method is used to describe the communication options for the target resource. It is often used to support CROS (Cross-Origin Resource Sharing) and other capabilities.
Example
8. TRACE
The TRACE HTTP Method is used to perform a message loop-back test along the path to the target resource. It helps in debugging and diagnostics but is often disabled for security reasons.
Example