HTTP-Methods-NOTES

GET is used for passing insensitive information.

POST is used for passing sensitive information.

PUT is used for passing updating whole sensitive information.

PATCH is used for passing updating pieces of sensitive information.

DELETE is used for passing deleting sensitive information.

When you create a form tag in HTML, you always need to specify the method used to send the request. The method attribute specifies the type of HTTP request by how you, as the developer, want to have your form information transferred. If your form data contains password data, credit card numbers, SSNs, etc, please use POST! If the information is something insensitive like a library search, it's OK to use GET as your method.

--GET--

When making GET requests, query parameters are sent as part of the URL. Ever noticed that when you do a Google search, your search term appears in the resulting URL? That's because it's a GET request! That wouldn't be very secure for passwords! Imagine if every time you logged into Gmail, it displayed your password at the top of the screen, right in your URL for the world to see! Worse still, GET requests can be cached, and will even remain stored in your browser's history! So why do we use GET at all? Well one neat thing, GET requests can be bookmarked! This lets you bookmark routes on say Google Earth or image results on a search engine.

--POST--

POST requests send data behind the scenes, inside the HTTP request body. They're never cached, they don't linger in your browser history, they can't be bookmarked, and there are no restrictions on how much data you can send. The vast majority of HTTP request methods you'll be dealing with will be POSTs. Forms that control user registration, user authentication, user authorization, and creating a new object to store in the database will all be processed as POST requests.

--PUT--

PUT requests work the same as POST requests; however, a PUT request is used to update a whole entity in the database.

--PATCH--

PATCH requests work the same as POST and PUT requests; however, a PATCH requests is used to update a piece of an entity in the database.

--DELETE--

DELETE requests are often used to delete an entity from the database.