Resolves HTTP protocol Six request methods get, PUT, post, delete, options, and trace meanings and differences.
1. GET SELECR
The request sends a request for data to the database to obtain the information, just like a database's select operation, which simply queries the data, does not modify, add data, and does not affect the contents of the resource , that is, the request does not have side effects. The results are the same no matter how many times you do it.
2. PUT Update
The request is to send data to the server to change the information, which, like the database update operation, modifies the contents of the data, but does not increase the type of data, that is, the result is not different regardless of how many put operations are made .
3. POST Insert
Requests are similar to a put request, where data is sent to the server, but the request alters resources such as the type of data, and creates new content, just like the insert operation for a database. Almost all of the current commit operations are requested by post.
4. Delete delete
The request, as its name implies, is used to delete a resource, which is like a database delete operation.
5. OPTIONS
It is used to get the methods supported by the current URL. If the request succeeds, it contains a header named "Allow" in the HTTP header, which is the supported method, such as "GET, POST"
Sum up:
1, Post/url Update
2, delete/url/xxx Delete
3. Put/url/xxx creation
4. Get/url/xxx View
The above six methods, we can with the database of crud additions and deletions to the operation corresponding to:
Create:put
Read:get
Update:post
Delete:delete thus achieves the perfect unification of HTTP and database operations (in fact, not just databases, any data, such as file diagrams), which is one of the essence of rest.
HTTP protocol Request method