Difference between HTTP Methods (Get & Post)

Sharing is Caring

It has been quite a while since I have used Yahoo! Answers. I often find many of the answers to questions are blatantly wrong or that the person answering doesn’t really provide a link to additional information. This blog post is designed to include additional information on the Get & Post methods of HTTP and what should be one of the simplest topics, but isn’t because some people insist on using large words like idempotent.

HTTP uses two methods of getting and receiving data from a webserver, generally these two methods can be split into two simple phrases:

  • Get = operations that can be safely repeated because there’s no side effects. Never use get for sensitive operations, or when uploading files.
  • Post = operations that might have side effects. I always use post for any operation, I don’t want repeated again; usually this is any operation that involve database manipulation like creates, updates, or deletes.
  • The default for form submission, or even just simple website browsing is a get request. Basically, every time you click a link this a get request and most of the time you submit a form this is a post request. When using a get request to pass information, you will often see what variables after a question mark, called parameters in the url.

    Get Method
    This blog post’s web address ( http://brcline.com/blog/?p=98 ) makes use of a parameter in it’s url. The parameter or variable is simply the letter p which we can easily see is equal to 98 and because of the parameters being in URL.

    Unfortunately as a result of the parameters being in the url there is a limit of how much data can be submitted (256 bytes is the limit in some browsers.) Obviously, using get requests is not a secure operation as the user can clearly see what is being passed along and what each value is equal to. One of my favourite uses of the Get request is to use it for anything, I would want the user to be able to link or bookmark as this page should always work.

    Post Method
    Post is the slightly more secure of the two methods but should never be the only technique used for operations involving Credit Cards, Identification Card Numbers (Social Insurance Number, Driver’s License Number,etc ).

    Post relies on data being sent back to the server in a content message that contains the parameters and their respective values. The content messages do not have a defined maximum length, so this is the prefered method of submitting anything with lenghty text or many answers.

    Sharing is Caring

    Brian is a software architect and technology leader living in Niagara Falls with 13+ years of development experience. He is passionate about automation, business process re-engineering, and building a better tomorrow.

    Brian is a proud father of four: two boys, and two girls and has been happily married to Crystal for more than ten years. From time to time, Brian may post about his faith, his family, and definitely about technology.