HTTP Methouds
HTTP Methouds
The GET method is one of the most commonly used methods of HTTP. It is usually implemented
to request a particular
resource data from the Web server by specifying the parameters as a query string (name and value
pairs) in the URL part of the request.
Example:
http://example.com/category/index.php?category_name=HTML&lesson=introduction
The various characteristics of the GET method are:
•The GET requests can be bookmarked as they appear in the URL.
•The GET request can be cached.
•The GET request is saved in the browser history if it is executed using a web browser.
•There are character length restrictions (2048 characters maximum) for this method as they appear in the
URL.
•The GET method cannot be used to send binary data such as images and Word documents.
•The data can only be retrieved from requests that use the GET method and have no other effect.
•When communicating sensitive data such as login credentials, a GET request should not be used as it
appears in the URL, making it less secure.
•Since the GET request only requests data and does not modify any resources, it is considered a safe and
ideal method to request data only.
The POST method is a commonly used HTTP method that sends data to the Web server in the
request body of HTTP. The various characteristics of the POST method are:
•The POST requests cannot be bookmarked as they do not appear in the URL.
•The POST requests do not get cached.
•The POST requests are not saved as history by the web browsers.
•There is no restriction on the amount of data to be sent in a POST request.
•The POST method can be used to send ASCII as well as binary data.
•When communicating sensitive data, such as when submitting an HTML form, a POST
request must be used.
•The data sent by the POST method goes through the HTTP header, so security depends on the
HTTP protocol. By using secure HTTP (HTTPS), you can ensure that your information is
protected.
The HTTP PUT request method is used to update existing resources with uploaded
content or to create a new resource if the target resource is not found. The difference
between POST and PUT is that PUT requests are static, which means calling the same
PUT method multiple times will not yield a different result because it will update the
same content each time while POST Request Will create new content each time.
The HTTP HEAD method is almost identical to
the GET method, but the only difference is that
it will not return any response body. For
example, if GET/users return a record of users,
then HEAD/users make the same request, but it
will not return any of the users' records.
The HEAD request becomes useful for testing
whether the GET request will actually respond
before making the actual GET request.
Sometimes this will be useful in some
situations, such as checking the response of a
URL before downloading a file.
The HTTP DELETE method is used to delete any specific resource.
The HTTP TRACE method is used for
performing a message loop-back, which tests
the path for the target resource. It is useful
for debugging purposes.