Rest:representational state Transfer representational states transfer
Restful:rest+ful adjectives, applications or designs that follow the Rest principle
Rest principle:
1. Everything on the network is abstracted as a resource
2. Each resource has a unique resource identifier (URI) and the various operations on the resource do not change the resource identifier
3. The same resource has multiple manifestations (Xml,json, etc.)
4. All operations are stateless, the server side should not save too many context states, that is, each request is independent
5. Use the HTTP verb: GET POST PUT Delete to operate
RESTful Architecture : The architecture that implements the above principles. Advantages:
1. In the Internet environment, any application architecture and API can be quickly understood;
2. In a distributed environment, any request can be sent to any server;
3. In heterogeneous environments, access to and use of any resource is unified;
HTTP operations prior to restful:
HTTP://127.0.0.1/USER/QUERY/1 GET query user data based on user ID
Http://127.0.0.1/user/save POST New User
Http://127.0.0.1/user/update POST Modify user Information
Http://127.0.0.1/user/delete get/post Delete User information
RESTful usage:
HTTP://127.0.0.1/USER/1 GET query user data based on user ID
Http://127.0.0.1/user POST New User
Http://127.0.0.1/user PUT Modify user Information
Http://127.0.0.1/user Delete User Information
The choice of the former basically conforms to the simple use of Get, complex object with post; But in rest, get corresponds to querying a resource, while post corresponds to a new resource, meaning is decidedly different.
Some of the implementation details of the restful:
1. Use HTTP verbs to indicate additions and deletions, GET: Query, POST: Add, PUT: Update, delete: delete
2. Return the result in JSON format
3. Return HTTP status Code 200 successful, 4** code or permissions problems, 5** server has a problem, specifically to be added ...
Rest and RESTful & HTTP