Some basic concepts of the Rest ful API

Source: Internet
Author: User
Tags representational state transfer



0, application background


The Rest ful API is Fielding (Uncle downstairs) in his paper "Architectural Styles and the Design of network-based software Architectures", paper address : http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm. (。。。 )




Because recently do hybird App, need to call the interface that uses sping MVC release, want to try a new interface form, want to be able to standardize the interface development, convenient to call, concrete have what good effect, again discuss.


Two, REST ful basic Concepts


rest:representational State Transfer, which is the representation level transition. On the network, we locate the resource by URI, and then the concrete form of the resource presentation is called its "presentation layer".


Understanding State Transitions:



Third, the unspoken rules of the URI


In the rest ful API design, the client operates on server-side resources through four HTTP verbs, enabling "presentation State transformation", so we can see that the resource operations represented in each URL are placed in the HTTP request, so in the URL, There should be no more verbs involved.


The URI that represents the resource should contain only nouns.


Four, commonly used HTTP verbs




Five, interactive implementation of front-end and background



The front-end operation of the API data is placed in our Angularjs service module, $resource to access our API interface, to achieve the crud operation of the data, in fact, it feels similar to the Ajax in our JQ, but there are certainly some small details to be aware of.


In the background, primarily in the Spring MVC controller, for methods, we recommend returning JSON data through the @responsebody annotation notation method and introducing the Jackjson jar package in the spring The MVC configuration file is included in a configuration that returns JSON. (depending on the version of Spring MVC).


With regard to the separation of mobile and background development, the use of fake data from wild dog simulations is currently used instead of using native JSON. The previous period of time to see Nodejs, found Nodejs inside there is a module faker, but also has this effect, but also wood has specific attempts, but the use of Nodejs for development can also be done to separate the two ends of the development. When we have time to study, the useful gods can leave a message.






Some basic concepts of the Rest ful API

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.