Copyright

What is a REST Web Service? - Tutorial & Example

Instructor: Kent Beckert

Kent is an adjunct faculty member for the College of Business at Embry-Riddle Aeronautical University and has a Master's degree in Technical Management.

REST stands for Representational State Transfer, a communication architecture based on web services. We'll talk about REST features, characteristics, and basic design guidelines. We'll include examples of the POST and GET requests in REST.

What is REST?

Several friends and co-workers are gathered around your computer viewing the recent Web service you created. Ben, a long-time friend questions whether you did the programming yourself or if you received help from a professional. Everyone in the room waits for your response.

'No help, I did this myself. You know I have some programming experience on Web service architectures, mostly with a simple one called Representational State Transfer (REST). By using REST, I am able to make Web service requests between different computers using HTTP verbs like CREATE, READ, UPDATE, and DELETE.

'I have little experience with more complex Web service architectures like Common Object Request Broker Architecture (CORBA) and Simple Object Access Protocol (SOAP). Why don't you have a seat and I'll explain why REST is preferred over CORBA and SOAP, how REST is used, and its benefits.'

What Makes REST a Preferred Architecture?

Do you remember studying the architecture of century old buildings erected by various cultures and societies around the world? Some of these buildings are still standing. REST is an architectural style using the same sturdy foundations as the early web structures, namely: design, form, construction, and resources.

REST, relies on the HTTP protocol to communicate over the network establishing and maintaining connections between multiple networked computers unlike the more complex tools like CORBA and SOAP. CORBA architecture enables communications over diverse platforms, and SOAP is equally complex being based on Extensible Markup Language (XML). Because HTTP is used by REST, you could say that the Internet employs a REST-based architecture.

REST Features

REST conveys information through HTTP such as photos, video clips, Web pages, and even detailed business data in the form of graphs or diagrams. These are all referred to as 'resources'.

One significant advantage REST has over its competition is that REST provides a window for users to access Web services. Many Web service developers prefer REST because implementation is less complex, the services are easier to maintain, and they are expandable. These developed REST services are often referred to as RESTful applications.

RESTful applications are created using characteristics which tend to separate REST from the other Web service development tools. Several REST characteristics are listed and described in the table below.

REST Characteristics Description
Stateless Ability to handle network communicative services as independent pairs (a request and its matching response).
Client-Server A network architecture in which nodes on the network act as a client (user) or a server managing services such as: file management, printer servers, and network activities.
Cacheable A form of data storage where data are stored locally, increasing the speed of storage and retrieval operations.
Protocol RESTful applications use HTTP to create, read, update, and delete resources.
Uniform Interface The developer reaches all resources using HTTP to make GET, POST, PUT, and DELETE requests.
Common Names REST resources are nouns, which are named using a Uniform Resource Locator (URL).

Guidelines for Web Service Design in a REST Network

Here are some general guidelines you should consider when creating a Web service for use on a REST network:

1. List out your resources using nouns like: ingredients, measurement data, and payment receipt.

2. REST resources should be nouns and not verbs as is the case with CORBA, and SOAP. For example create your URL as: http://www.menu-dinner.com/ingredients/12345 instead of using a verb form similar to: http://www.menu-dinner.com/ingredients/getingredients?id-12345.

3. Categorize each resource as 'retrievable' using HTTP: GET, or 'modifiable' using HTTP: POST, PUT or DELETE.

4. Provide hyperlinks enhancing search efforts.

To unlock this lesson you must be a Study.com Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account
Support