HTTPS Methods with Examples

 HTTPS is a protocol used for communication between a client (web browser) and server (Web server). It defines various methods (or verbs in English grammar) that can be used to specify the action which a client wants to perform on a resource identified by a URL. Here are some common method with example.

HTTPS Methods


1. GET 

It retrieves a resource from the server.

example - GET https://www.abc.com/api/users/321

This request retrieves user data for user with user ID 321 from the server.

2. POST

It sends data to the server to create a new resource.

example - POST https://www.abc,com/api/users
                 Body : {"name" : "John", "age" : 20}

This POST request will create a new user on the server with the given name and age.

3. PUT

It sends data to server to update an existing resource.

example - PUT https://www.abc.com/api/users/321
                 Body : {"name" : "John Cena", "age" : 30}

This request updates the user data for user with ID 321 on the server with the new name and age.

4. DELETE

It deletes a resource on the server.

DELETE https://www.abc.com/api/users/321

This request will delete the user (resource) with user id 321.

5. PATCH

It sends partial data to the server to update an existing resource.

PATCH https://www.abc.com/api/users/321
Body : ("age" : 36}

This request updates the age of the user with id 321 on the server without modifying the other fields.

6. HEAD

It retrieves only the headers of a resource from the server without the actual body.

HEAD https://www.abc.com/api/users/321

This request retrieves only the headers (meta data) of the user data for user with ID 321 from the server, without the actual data.

7. OPTIONS

This method request information about the communication options available for the resource identified by the URI (Uniform Resource Identifier).

8. CONNECT

This method establish a network  connection to a resource , typically for use with a proxy server. It is not commonly used in regular web request.

9. TRACE

This method request a diagnostic trace of the request and response message for a source. It is used for the debugging purpose to trace the request and response flow between client (web browser) and server (web server). 




Comments