Get-and-Post Methods in HTTP

The Difference Between Get-and-Post Request Methods

Harsh Gupta - Tech Writer
HTTP stands for Hyper Text Transmission Protocol. Today, HTTP is recognized as a worldwide standard and is used on Internet. There are several Web sites that require users to fill out the form, and these Web sites do use some kind of method to post the data of the form to their database. Two methods are used to perform this operation. One is the Get method and the other is the Post method. Both the methods can be used to post the user data on to the database. This is where the problem arises.

As the word suggests Get method is used to get the data from somewhere, whereas, Post method is used to put data somewhere. Many people are confused about the usage of these 2 methods as a result of which they create a blunder. There are website designers who are not aware of the consequences of using the Get method instead of the Post method. Below is the difference between the two.

GET Method

In case of Get method, request parameters are added along with the request and then transmitted as a query to the server.

If you are using GET method, you are limited to a maximum of 256 characters in the URL, minus the number of characters in the actual path. Moreover the contents of data are visible in the URL.

GET is used for just retrieving the data.

A GET request is often cacheable, i.e the browser bookmarks the response returned from the request.

GET is typically used to access the static resources, such as HTML documents and images.

GET requests are inherently (according to HTTP spec) IDEMPOTENT. It means you can do same thing over and over again (like retrieving any picture file from server), with no un-wanted side-effects on the server.

The major objective of using GET request is that, the request does not changes anything on the server, however you can write a bad, non-idempotent doGet() method.

POST Method

In case of Post method, request parameters are encoded within the body and then transmitted along with the body of request.

POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the header and not in the URL, thus contents of data are NOT visible in the URL.

POST may involve anything like, saving or updating the data, or ordering the product, or sending e-mail.

A POST request can hardly be cacheable.

POST is typically used to transmit the information that is request-dependent, or when a large amount of complex information must be sent to the server.

POST request are inherently NON-IDEMPOTENT, it is frequently used, when processing of the request changes the state of the server, such as storing data in database.

The major objective of POST request is that request changes something on server, for example the data submitted in the body of POST request might be destined for a transaction that cannot be reversed, however you have to design your application in such a way, that if the client sends the same request TWICE by mistake, your code should handle it

Published by Harsh Gupta - Tech Writer

I am a part time freelancer and writing is my hobby Some of my websites: http://www.GenericArticles.com http://www.JailBreakingiPhone.com  View profile

  • GET is used for just retrieving the data.
  • A GET request is often cacheable, i.e the browser bookmarks the response returned from the request.
  • A POST request can hardly be cacheable.
POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the header and not in the URL, thus contents of data are NOT visible in the URL.

To comment, please sign in to your Yahoo! account, or sign up for a new account.