The
http protocol supports methods such as get, post, put, delete, patch, trace, head, options. Restful sets out the rules for using these methods. You can also use the get method to delete resources. It just doesn't match semantically. It's hard to understand. It is not only after the emergence of the style and specification of restful that these methods come into being. It's already there. The method of the
http protocol is part of the http protocol specification. You can refer to the following [http/1.1]
( https://www.w3.org/Protocols/.
truth is that get post these http verbs must be determined by the http protocol.
if it's not RESTful, then why does RPC have POST and GET??
RESTful is more like an agreement. For example, after you talk to Zhang San, we will use GET to get POST.
then the server does this to the requests from the foreground.
in other words, tomorrow you and Zhang San tell us to make another agreement ourselves, called anti-RESTful, so use GET to build it, and POST to get it. (of course, this game is not good in all senses)
The
HTTP protocol specifies GET and POST request methods, but it is important to note that these methods themselves contain semantics.
GET it's easy to understand what it means to get.
generally POST is understood as creating a resource, and PUT is understood as updating a resource.
The
HTTP protocol itself represents the mapping of resources through URL , represents operations on resources by request (including, but not limited to, create, delete, update, find, that is, CRUD ), and uses HTTP status codes to indicate the results of the operation.
and RESTful actually focuses on how to map resources to URL . It's just a specification that tells you what a good design is, and it doesn't strictly dictate everything.
the above is only for personal understanding, if there are any mistakes, please do not hesitate to comment!