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.

    Author: Brian Cline

    Brian is a programmer living in Niagara Falls with ten years of development experience. He is passionate about automation, business process re-engineering, and gamification. For the last six years or so, he has been working with Salesforce and JavaScript.

    Related Posts

    Sharing is Caring