HTTP METHODS

HTTP METHODS

Table of Contents

HTTP methods indicate the desired action to be performed on the identified source. The HTTP defines certain methods. Any client can use those methods and therefore the server which may be configured to support any combination. If any method is intermediate, it will be treated as an unsafe and non-idempotent method.  Few http methods like: 

  • GET, 
  • POST, 
  • PUT, 
  • DELETE, 
  • CONNECT, 
  • TRACE 

methods are explained here.

  1. GET

A GET request fetches the data from a web server by specifying elements in the URL part of the request. This is considered as main method for document retrieval. We can use this method very easily. This method contains URL(Link). For example

We can type in URL, any website name that will do get request task and the server will respond by opening the webpage.

HTTP METHODS

By using GET request we can read server side data, retrieve server side data or update server side data.

  1. POST Method

The POST method is used when we want to send the data to the server like we want to retrieve the data or update the data. In this POST body, we use URL as well as request body, for example

https://example.com/test/demo_form.php Http/1.1

name1=value1& name2=value2

Here there are two parts. In the first part we enter the URL address and in the second part we have request body where we send data .

The main difference between GET method and POST is, in the GET method we enter address and data all in url and request but in POST method we send data separately in the request body so that the data remains secure and hidden. Consider an example for google forms

HTTP METHODS

When you enter all the details like name, address qualification etc and at the end when you click submit button the server will store all the data in the request body and through the help of URL address it sends the request message to the server and based on that the server provides the response.

  1. PUT method

PUT method is used to request the server to store the involved entity body at  a location specified by a given URL. PUT puts a file or resource at a specific URL and exactly at the URL. If there is a file or resource already, PUT replaces that file or resource. If there is no file or resource the PUT creates one.

Consider a sample example of HTTP PUT request and response

PUT /hello.htm HTTP/1.1

User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: www.iitworkforce.com
Accept-Language: en-us
Connection: Keep-Alive
Content-type: text/html
Content-Length: 182
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
Response is
HTTP/1.1 201 Created
Date: Mon, 27 Jul 2009 12:28:53 GMT
Server: Apache/2.2.14 (Win32)
Content-type: text/html
Content-length: 30
Connection: Closed
<html>
<body>
<h1>The file was created.</h1>
</body>
</html>

In this example, we are requesting for creating or updating the resource. Whenever PUT request is placed it will check the whether the resource is present in the server if it is not then it will update the resource. Correspondingly the server sends the response to the client machine for the request.

  1. DELETE method

The DELETE method is used to request the server to delete a file at a location specified by the given URL. The example of DELETE request and response are

DELETE /hello.htm HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: www.iitworkforce.com
Accept-Language: en-us
Connection: Keep-Alive


HTTP/1.1 200 OK
Date: Mon, 27 Jul 2021 12:28:53 GMT
Server: Apache/2.2.14 (Win32)
Content-type: text/html
Content-length: 30
Connection: Closed
<html>
<body>
<h1>URL deleted.</h1>
</body>
</html>

In this example the server will delete the mentioned file hello.htm and sends the response to the client.

  1. CONNECT Method

The CONNECT method is used by the client to connect the connection or create the network connection to a web server over HTTP methods. For example

CONNECT www.iitworkforce.com HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)

When the connection is established the server response is sent back to the client.

HTTP/1.1 200 Connection established
Date: Mon, 27 Jul 2009 12:28:53 GMT
Server: Apache/2.2.14 (Win32)
  1. TRACE method

The TRACE method uses to echo the contents of an HTTP request back to the requester which can be used for debugging purpose at the time of development. For example

TRACE / HTTP/1.1
Host: www.iitworkforce.com
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)

The server response is sent back for the above client request.

HTTP/1.1 200 OK
Date: Mon, 27 Jul 2009 12:28:53 GMT
Server: Apache/2.2.14 (Win32)
Connection: close
Content-Type: message/http
Content-Length: 39

TRACE / HTTP/1.1
Host: www.tutorialspoint.com
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)

13 Responses

  1. The primary or most commonly-used HTTP methods are POST, GET, PUT, PATCH, and DELETE. These methods correspond to create, read, update, and delete (or CRUD) operations, respectively. HTTP defines a set of request methods to indicate the desired action to be performed for a given resource. GET is meant to allow you to ‘get’ things from the server. Likewise, PUT allows you to set something new on a server and DELETE allows you remove something. POST ‘s biggest original purpose is submitting forms.
    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 server. Example: A client (browser) sends an HTTP request to the server; then the server returns a response to the client. PATCH is a method of modifying resources where the client sends partial data that is to be updated without modifying the entire data. PUT is a method of modifying resource where the client sends data that updates the entire resource .

  2. HTTP methods indicate the desired action to be performed on the source.
    In this article, the methods mentioned are as followed GET, POST, PUT, DELTE, CONNECT, TRACE
    1. GET; a GET request fetches the data from a web server by specifying elements in the URL part of the request.
    2. POST; The POST request allows the data to be observed through two variations of programs; the main difference between GET and POST is that GET allows you to send the address and data in url/request but in POST we send data separately so that the data remains secure and hidden.
    3. PUT; the PUT method is used to request the server to store the involved entity body at a location specified by a given URL. PUT puts a file or resource at a specific URL and exactly at the URL.
    4. DELETE; The DELETE method is used to request the server to delete a file at a location specified by the given URL.
    5. CONNECT; The CONNECT method is used by the client to connect the connection or create the network connection to a web server over HTTP methods.
    6. TRACE; The TRACE method echoes the contents of an HTTP request back to the requester which can be used for debugging purposes at the time of development.

  3. TTP methods indicate the desired action to be performed on the identified source. The HTTP defines certain methods. Any client can use those methods and therefore the server which may be configured to support any combination. If any method is intermediate, it will be treated as an unsafe and non-idempotent method. Few http methods like: GET, POST, PUT, DELETE, CONNECT, TRACE
    *A GET request fetches the data from a web server by specifying elements in the URL part of the request.
    *The POST method is used when we want to send the data to the server like we want to retrieve the data or update the data.
    *PUT method is used to request the server to store the involved entity body at a location specified by a given URL.
    *The DELETE method is used to request the server to delete a file at a location specified by the given URL
    *The CONNECT method is used by the client to connect the connection or create the network connection to a web server over HTTP methods.
    *The TRACE method uses to echo the contents of an HTTP request back to the requester which can be used for debugging purpose at the time of development.

  4. HTTP methods indicate the desired action to be performed on the source. The HTTP defines certain methods. The methods mentioned are as followed:
    1. GET
    2. POST
    3. PUT
    4. DELETE
    5. CONNECT
    6. TRACE
    1. GET: request fetches the data from a web server by specifying elements in the URL part of the request.
    2. POST: request allows the data to be observed through two variations of programs; the main difference between GET and POST is that GET allows you to send the address and data in url/request but in POST we send data separately so that the data remains secure and hidden.
    3. PUT: method is used to request the server to store the involved entity body at a location specified by a given URL. PUT puts a file or resource at a specific URL and exactly at the URL.
    4. DELETE: method is used to request the server to delete a file at a location specified by the given URL.
    5. CONNECT: method is used by the client to connect the connection or create the network connection to a web server over HTTP methods.
    6. TRACE: method echoes the contents of an HTTP request back to the requester which can be used for debugging purposes at the time of development.

  5. TTP methods indicate the desired action to be performed on the identified source. The HTTP defines certain methods. Any client can use those methods and therefore the server which may be configured to support any combination. If any method is intermediate, it will be treated as an unsafe and non-idempotent method. Few http methods like: GET, POST, PUT, DELETE, CONNECT, TRACE
    *A GET request fetches the data from a web server by specifying elements in the URL part of the request.
    *The POST method is used when we want to send the data to the server like we want to retrieve the data or update the data.
    *PUT method is used to request the server to store the involved entity body at a location specified by a given URL.
    *The DELETE method is used to request the server to delete a file at a location specified by the given URL
    *The CONNECT method is used by the client to connect the connection or create the network connection to a web server over HTTP methods.
    *The TRACE method uses to echo the contents of an HTTP request back to the requester which can be used for debugging purpose at the time of development.

  6. HTTP methods indicate the desired action to be performed on the identified source. The HTTP defines certain methods. Any client can use those methods and therefore the server which may be configured to support any combination. If any method is intermediate, it will be treated as an unsafe and non-idempotent method. Few http methods like:
    GET : A GET request fetches the data from a web server by specifying elements in the URL part of the request. This is considered as main method for document retrieval. We can use this method very easily.
    POST : The POST method is used when we want to send the data to the server like we want to retrieve the data or update the data.
    PUT : PUT method is used to request the server to store the involved entity body at a location specified by a given URL.
    DELETE : The DELETE method is used to request the server to delete a file at a location specified by the given URL.
    CONNECT : The CONNECT method is used by the client to connect the connection or create the network connection to a web server over HTTP methods.
    TRACE : The TRACE method uses to echo the contents of an HTTP request back to the requester which can be used for debugging purpose at the time of development.

  7. The HTTP defines certain methods. Any client can use those methods and therefore the server which may be configured to support any combination. If any method is intermediate, it will be treated as an unsafe and non-idempotent method. http methods:
    GET,POST, PUT, DELETE, CONNECT, TRACE
    GET- A GET request fetches the data from a web server by specifying elements in the URL part of the request.

    POST-The POST method is used when we want to send the data to the server like we want to retrieve the data or update the data.

    PUT-PUT method is used to request the server to store the involved entity body at a location specified by a given URL.

    DELETE-The DELETE method is used to request the server to delete a file at a location specified by the given URL

    CONNECT-The CONNECT method is used by the client to connect the connection or create the network connection to a web server over HTTP methods.

    TRACE-The TRACE method uses to echo the contents of an HTTP request back to the requester which can be used for debugging purpose at the time of development.

  8. HTTP methods:
    HTTP methods indicate the desired action to be performed on the identified source. HTTP defines some methods. Any user can use those methods and therefore which server is configured may support to the combination.

    HTTP methods are : GET , POST , DELETE, TRACE , PUT, CONNECT

    GET: This method is used for document retrieval . This method contains URL . By using GET method we can read server side data ,retrieve server side data and update server side data.

    POST : This method is used when we want to send data to server. This method contains two parts : URL and request body which we want to send.
    e.g. examplecom/test/demo_formphp Http/1.1
    name1=value1 & name2 = value2

    PUT: PUT method is used to request the server to store data on the specified URL . If there is file or resource is already exist then it replaces the data . if file /resource is not there then it creates new one.

    DELETE : This method is used to request the server to delete a file at a location specified in the given URL.

    CONNECT : This method is used by client to connect connection or create the new connection to the web server over the http methods.

    TRACE : This method is used to echo the contents of an HTTP request back to requester which can be used for debugging purpose at the time of development.

  9. HTTP methods indicate the desired action to be performed on the identified source. The http defines certain methods that any client can use and the server therefore may be configured in such way that any combination can support the few HTTP methods are like
    GET
    POST
    PUT
    DELETE
    CONNECT
    TRACE

    The get method is to get the data, The post is to send or update the data .THE Put is to replace and restore the data and if it already exist it will replace aur create the new one , The Delete is to delete the existing fille aur any Request aur Response. The connect method is used by the client to connect to the network aur setup a connection between client and server .The TRACE method uses to echo the contents of an HTTP request back to the requester which can be used for debugging purpose at the time of development..

  10. HTTP methods indicate the desired action to be performed on the source. The HTTP defines certain methods. The methods mentioned are as followed:
    1. GET
    2. POST
    3. PUT
    4. DELETE
    5. CONNECT
    6. TRACE
    1. GET: request fetches the data from a web server by specifying elements in the URL part of the request.
    2. POST: request allows the data to be observed through two variations of programs; the main difference between GET and POST is that GET allows you to send the address and data in url/request but in POST we send data separately so that the data remains secure and hidden.
    3. PUT: method is used to request the server to store the involved entity body at a location specified by a given URL. PUT puts a file or resource at a specific URL and exactly at the URL.
    4. DELETE: method is used to request the server to delete a file at a location specified by the given URL.
    5. CONNECT: method is used by the client to connect the connection or create the network connection to a web server over HTTP methods.
    6. TRACE: method echoes the contents of an HTTP request back to the requester which can be used for debugging purposes at the time of development.

  11. HTTP methods indicate the desired action to be performed on the identified source. The HTTP defines certain methods,any client and therefore the server can use those methods which may be configured to support any combination. Few http methods are: GET, POST,PUT,DELETE,CONNECT,TRACE .
    1.GET method:
    A GET request fetches the data from a web server by specifying elements in the URL part of the request. This is considered as main method for document retrieval. By using GET request we can read server-side data, retrieve server-side data or update server-side data.
    2.POST method:
    The POST method is used when we want to send the data to the server like we want to retrieve the data or update the data.
    3.PUT method:
    PUT method is used to request the server to store the involved entity body at a location specified by a given URL. PUT puts a file or resource at a specific URL and exactly at the URL. If there is a file or resource already, PUT replaces that file or resource. If there is no file or resource the PUT creates one.
    4.DELETE method:
    The DELETE method is used to request the server to delete a file at a location specified by the given URL.
    5.CONNECT method:
    The CONNECT method is used by the client to connect or create the network connection to a web server over HTTP methods.
    6.TRACE method:
    The TRACE method uses to echo the contents of an HTTP request back to the requester which can be used for debugging purpose at the time of development.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this article
Subscribe
By pressing the Subscribe button, you confirm that you have read our Privacy Policy.
Need a Free Demo Class?
Join H2K Infosys IT Online Training
Enroll Free demo class