This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why Post for update and Get Not for update ?

 
Yati Tan
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have some doubt abt POST and GET Form Methods. Its written in HFSJ (Pg 111) that Post is used for updating database. Get is meant to be for getting things and POST is for updating database.

But, in real world I hv used both for updating and getting things from database.

Pls explain me - if anybody can.

Thanks alot,
yati
 
Mat Williams
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

There is no hard and fast rule that says you have to use Put when you update the database. The w3c says that Get should be idempotent whereas Put does not have to be idempotent, this can not be enforced though, it is just considered good practice. So yes you can use both Get and Put to update the database as you have done in the past, some would say that this is not good practice though.

Mat
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To add-on, data that you send as GET request is visible as query strings. Whereas, POST sends data in the request body and hence, it is not visible. The length of the data is restricted in GET whereas POST can take in large data that needs to be updated to the database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic