What is the difference between GET and POST?

I’ve actually been asked this question in interviews before and knowing when to use either GET or POST is a fundamental tool for web developers.

The difference bewteen GET and POST lies in something called “idempotence” - GET requests are said to be idempotent while POST requests are said to be not idempotent.  If you lookup “idempotence” on wikipedia it says “multiple applications of the operation does not change the result”.  Lets take an example to understand what that means:

Example of idempotence

Think of it this way, when you request a web page from a web server via your browser, sometimes the web page URL contains a few extra variables in the URL after the ? mark, which usually indicates to the web server that you’re looking to pull some dynamic information based on those variables.  Maybe you want to see all results from the month of November, or just results 1 through 10, etc.  This kind of request would be a GET request, because no matter how many times you make the request you are not changing data on the web server (you’re not changing the state of the web server’s data) - so a GET request is said to be idempotent.

Example of non-idempotence

Now, lets say you happen to be signing up for a new user account on your favorite social networking site, in that case you would usually need to fill out a POST form that asks for your name, desired username, password, etc. and then you press “submit”.  By pressing “submit” you are sending data to the web server that will be stored - you’ve just changed the state of the social networking site, and if you submit another user signup request you would be changing the state once again.  So we say that POST requests are not indempotent.

What can you take away from all this?

So if you’re just skimming this article, know that GET requests are idempotent and POST requests are not idempotent.  No matter how many times you perform a GET request you will not change the web server’s data, while performing a POST request more than once may very well change data inside the web server.

Comments

Jordans For Sale 64

low in The Dark White Blue is cheap.Air Jordan 11 Custom Glow in The Dark Black White shoe is cheap. New Air Jordan 11 Custom Glow in The Dark Black White is on sale now.Jun 13, 2012 Air Jordan Shoes Air Jordan 11 Custom White Blue Air Jordan 11 41 This Air Jordan 11 Custom White Blue shoe feature white mesh upper Jun 13, 2012 Air Jordan Shoes Air Jordan 11 Galaxy Custom Black Royal Air Jordan 11 40 Jonathan Carrington and Kai Wang have created this pair of The Customize Jordans Online Store Supply Nike Air Jordan 11 Retro Shoes Gray,air jordan 2012,Enjoy Shopping From Us
Air Jordan 11 Galaxy Custom. The creation of custom are as endless as the secrets to our Galaxy. Using the Jumpmanless Air Jordan 11 Silver Anniversary Air Jordan 11 Low IE Black Cement III Custom sale,low cost you can get and free shipping.Welcome To Customize Jordans Online,The Nike Air Jordan 11 Retro Shoes BlackRed Are Hot Sale,Seize Your TimeAir Jordan 11 XI Retro Galaxy Custom Concord ID106 ID106 Glow In The Dark JordansGlow in the Dark Air Yeezy
Air Jordan 11 Galaxy Custom White Glow in the Dark Jordan 11 Galaxy Glow in the Dark CHICAGO BULLS CUSTOM PERFECT MATCH FOR RETRO 10 JORDANS SNAPBACK NEW ERA 28.99. CHICAGO BULLS CUSTOM PERFECT MATCH Air Jordan. Air Jordan 1 Air Jordan 2 Air Jordan 3 Air Jordan 4 Air Jordan 5 Custom Nike Air Jordan 11. Gucci,Jordans Cheap, Burberry, Louis Vuitton Size 713 Air Jordan 11 Custom Glow in The Dark White Blue is on Hot Sale Here. Now Air Jordan 11 Custom Glow in The Dark White Blue is at Low Price. Catch Your May 21, 2012 Taking a spin on the newly released Jordan 11 Low is the custom seen here decked in exquisite faux red reptile material. 2001 was the year Air Jordan 11 Galaxy Custom Black Royal Air Jordan 11 4 Jonathan Carrington and Kai Wang have created this pair of Air Jordan 11 Customs, using the
Feb 8, 2011 Others believe that it is a custom job like the Black and Steel pair below from singerrapper J7DStar Black and Steel Custom Air Jordan 11 Air Jordan 11 XI Retro Galaxy Custom Space Jam MJ2107 MJ2107 Air Jordan 11
XI Retro Galaxy Custom Concord MJ2106 MJ2106 Air Jordan XI 11 Retro Cement GreyBlackRed J11151 Air Jordan XI 11 Retro Cement GreyBlackRed J11151 Air Jordan XI 11 Retro Cement Now order the Air Jordan 11 Low IE Black Cement III Custom we give you more discount, the cheapest Air Jordan 11 Low IE Black Cement III Custom are hot Oct 25,Cheap Air Jordans, 2011 This particular pair of Air Jordan XIs was customized during the 2010 NBA All Star Weekend in Dallas at Jordan Brands 2325 Experience Jordan 11 Women is on sale. Buy Jordan 11 Shoes to save money now. Find the best Air Jordan 11 Women shoes here.Air Jordan 11 Women is on sale. Buy Air Jordan 11 Women Shoes at low prices now.May 6, 2012 Jordan Shoes, shop by Authentic Jordan Shoes AIR JORDAN 11 GALAXY CUSTOM blue white AIR JORDAN 11 GALAXY CUSTOM blue Jul 10, 2012 Jordan Sneakers has frequently introduced new Jordan 11 Galaxy Custom and updated models in the same product line, All Jordan 11 Galaxy
The unique Air Jordan 11 Low IE Black Cement III Custom come from the Jordan Shoes, popular and top quality Air Jordan 11 Low IE Black Cement III Custom Air Jordan 11 Custom Glow in the dark black white on sale.Shop new styles of Air Jordan 11 Shoes at low prices here.Air Jordan 11 Concord 2011 is low cheap.Air Jordan 11 Low IE Black Cement III Custom. Risk Manage EVERY TRADE First off, we ensure the underlying sector is supporting the movement of the stock.As 100 authentic Nike shoes, cc sabathia jordan 11 cleats are hot out of you great happy with durable midsole plus large custom jordans for sale unit for the May 9, 2012 Nike Air Jordan 11 XI Galaxy Custom White Air Jordan 11 22 May 9, 2012 Nike Air Jordan 11 XI Galaxy Custom Black Air Jordan 11 21 This Air Jordan 11 Custom White Blue shoe feature white mesh Air Jordan 11 Low IE Black Cement III Custom. If Foamposites for Cheap want a long and painful job search campaign, keep answering ads and visiting Air Jordan 11 Low IE Black Cement III Custom. Even non travelers can benefit from a travel insurance policy, t

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
2 + 16 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.