Rest and RESTful & HTTP

Source: Internet
Author: User
Tags representational state transfer

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.