Contact Us

Skype: techomechina
MSN: info@techomechina.com
Phone: +86 1062431711
Fax: +86 1062431800
Email: info@techomechina.com


Building A, UFIDA Software Park
68 Beiqing Rd.
Haidian District
Beijing China 100094



Home > Web Technology > Cloud Computing > RESTful Web Services - Representational State Transfer

RESTful Web Services - Representational State Transfer

 

Representational State Transfer (REST) is a style of software architecture for distributed hypermedia system introduced by Roy Fielding in his doctoral dissertation in 2000. REST is simply a way to design things to work like the web rather than tied to any particular technologies or platforms. The key feature of REST that makes REST different from other distributed architectural styles is its emphasis on a uniform interface between components.

 

REST as Lightweight Web Services

 

REST is considered as a lightweight alternative to web services and RPC, REST service has the following features:


    - Platform Independent: That means developers don't have to consider if the service is Unix, if the client is a Mac, or anything else.
    - Language Independent: For example, C# can talk to Java, etc.
    - Standards-based: It runs on top of HTTP.
    - It can be used in the presence of firewalls.

Developers have to think about things differently when they design a RESTful service. Instead of concentrating on designing methods, developers focus on the elements that decorate the system, for example, the URIs, and representations. In order to conform to the HTTP uniform interface with RESTful services, developers simply need to decide which of those methods they’ll support for each resource. Unlike traditional RPC-style frameworks that attempt to hide communication details, RESTful services fully take advantage of embracing HTTP and its features as much as possible. RESTful services automatically receive the valuable benefits inherent in the web platform that contains caching controls, the built-in security features, compression, and ultimately improved performance and scalability.

 

REST Design Guidelines


    - In REST style URL stand not for physical, but logical URL. That means, for example, http://mywebsite.com/blog/post/1 doesn’t have to have c:\inetpub\wwwroot\mywebsite\blog\post\1 file with static content. Clean and logical URL is one of the attractive points of REST.
    - Queries will provide a paging mechanism instead of return an overload of data if needed.
    - Make sure REST’s well documented, and do not change the output format lightly, even though the REST response can be anything.
    - Rather than letting clients construct URLs for additional actions, include the actual URLs with REST responses.
    - GET access requests should never cause a state change. Anything that changes the server state should be a POST request.

Benefits of REST


    - Clean & Well-designed URLs: Well-designed URLs have clear hierarchy, and they are hackable, reverse-engineered. These URLs have clear meaning and are not confused. They can be short or long with meaning.
    - Semantic URLs: The URLs contain semantic meaning, their information is logically architected in order to find their way around by looking at the URL.
    - Constrained Interface: Developers don't have to argue how the interface will work or what the actions will be, they can focus on the resources rather than how to access/manipulate each resource.