GET vs POST
·
A GET request is used to get data from the
server.
·
A POST request is used for modifying data on the
server.
When to use GET
If the processing of a form is idempotent (i.e. it has no
lasting observable effect on the state of the world), then the form method
should be GET. Many database searches have no visible side-effects and make
ideal applications of query forms.
Characteristics of GET:
·
Use GET for safe actions and POST for unsafe
actions.
·
GET requests can be cached
·
GET requests can remain in the browser history
·
GET requests can be bookmarked
·
GET requests can be distributed & shared
·
GET requests can be hacked
When to use POST
If the service associated with the processing of a form has
side effects (for example, modification of a database or subscription to a
service), the method should be POST.
Use POST when dealing with long requests – if you’re sending
large amounts of data, or sensitive data over HTTPS, you will want to use POST.
Some browser such as Internet Explorer place a limit on the URL string so this
may break the action of some forms if you use GET.
You may consider using POST for the following actions:
·
Posting a message to a bulletin board,
newsgroup, mailing list, or similar group of articles
·
Providing a block of data, such as the result of
submitting a form, to a data-handling process
·
Extending a database through an append operation
·
Annotation of existing resources
Good Luck…
No comments:
Post a Comment