The meaning and difference of Get, Put, Post, Delete




1. The GET request will send a request for data to the database to obtain information. This request is just like the select operation of the database. It is only used to query the data and will not modify or increase the data or affect the content of the resource. This request has no side effects. No matter how many times you do it, the result is the same.



2. The PUT request is to send data to the server (different from GET) to change the information. This request is like the update operation of the database, which is used to modify the content of the data, but it will not increase the type of data, etc., that is to say, no matter It doesn't make a difference how many times you do the PUT operation.



3. The POST request is similar to the PUT request, which sends data to the server, but the request will change the type of data and other resources, just like the insert operation of the database, it will create new content. Almost all submit operations today are made with POST requests.



4. As the name suggests, the DELETE request is used to delete a certain resource. This request is like the delete operation of the database.



As mentioned earlier, since both PUT and POST operations send data to the server, what is the difference between them? POST mainly acts on a collection resource (url), while PUT mainly acts on a (url/xxx) on the specific resource, in layman's terms, if the URL can be determined on the client, then PUT can be used, otherwise POST can be used.




  • In summary, we can understand the following:

      POST    /url     		创建  
      DELETE  /url/xxx  		删除  
      PUT     /url/xxx 	 	更新
      GET     /url/xxx  		查看
    


To sum up, Get is a request to send data to the server, and Post is a request to submit data to the server. In FORM (form), Method defaults to "GET". In essence, GET and POST are just sending mechanisms. It's different, it's not one take and one send.













Note:
Likes, comments, and reprints are welcome. Please give the link to the original text in an obvious place on the article page
. Those who know, thank you for reading my article in the vast crowd.
Where is the signature without personality!
For details, please follow me
and continue to update

Scan to have a surprise!
© 2020 11 - Guyu.com | 【All rights reserved】

Guess you like

Origin blog.csdn.net/weixin_49770443/article/details/109805845