1. What is REST?

REST stands for Representational State Transfer. (It is sometimes spelled "ReST".) It relies on a stateless, client-server, cacheable communications protocol -- and in virtually all cases, the HTTP protocol is used.

REST is an architecture style for designing networked applications. The idea is that, rather than using complex mechanisms such as CORBA, RPC or SOAP to connect between machines, simple HTTP is used to make calls between machines.

  • In many ways, the World Wide Web itself, based on HTTP, can be viewed as a REST-based architecture.

RESTful applications use HTTP requests to post data (create and/or update), read data (e.g., make queries), and delete data. Thus, REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations.

REST is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, et al.). Later, we will see how much more simple REST is.

  • Despite being simple, REST is fully-featured; there's basically nothing you can do in Web Services that can't be done with a RESTful architecture.

REST is not a "standard". There will never be a W3C recommendataion for REST, for example. And while there are REST programming frameworks, working with REST is so simple that you can often "roll your own" with standard library features in languages like Perl, Java, or C#.

27 comments:

Dr. M. Elkstein said...

Note that REST is actually used with two meanings, subtly different from each other. This can be confusing.

The pure meaning is the architectural style -- which is completely independent of HTTP and the Web. It can be used with HTTP and the Web, but it doesn't have to be.

The real-world meaning, most commonly used in the industry, is how REST is used in practice: HTTP-based, and with standard Web servers (e.g., Apache httpd) playing the part of REST servers.

Unless stated otherwise, the rest of this tutorial refers to the "real-world" usage of REST.

Mangol said...

Thanks a lot for this wonderful blog. It was lot helpful. But I'm lot confused between SOAP, RPC, XMLRPC, REST, Webservices.

Can you please clear them on this blog with clear examples of each. I don't know if there are other alternatives for SOAP. If there, please compare them.

Dr. M. Elkstein said...

Hello Mangol,

You might wish to take a look at pages 10 (ROA vs. SOA, REST vs. SOAP) and 11 (WSDL and WADL) for some answers.

The terms are often tainted, in the sense that the same term is used by different people, or in different contexts, to mean different things. Below is a very broad overview.

In general: RPC is any mechanism that allows you to execute methods remotely (although some technologies adapted that as a proper name, it's a general name for many such technologies). This includes CORBA, Java RMI, SOAP-based Web Services, and REST. Some of these systems use binary data transfer (CORBA, Java RMI), and others are text-based; some of the text-based ones are actually XML-based.

XMLRPC is a general name for any XML-based RPC system, i.e., a system where the data that passes between client and server is XML data. There are generic XMLRPC systems (Java's JAX-RPC comes to mind) but when discussing XMLRPC, the key technology is SOAP-based Web Services.

Web services is a generic name for web-based RPC. This includes SOAP-based web services, which normally go by the proper name "Web Services"; but now, REST is also considered a web-service architecture.

SOAP is an XMLRPC web service, i.e., a web-based RPC that uses XML for data transfer, and more specifically, it uses the SOAP data format (an XML schema) for the queries and their replies.

REST is a non-XML-based, web-based RPC; but it is also a design philosophy and architecture. Read this tutorial site for more details.

Prashant Jain said...

Good introduction to ReST. Read the whole thing, just could not stop in between :)

pavan said...

Thanks a lot for the tutorial, i just read few pages but surely finish the whole. I am one of the kind who like to read paper as a whole and printable document. Is there anyway that i can download and read not sitting before my laptop.
thanks,
pavan.

Dr. M. Elkstein said...

Hello Pavan,

I'm sorry, but at the moment Blogger (the platform I'm using to publish this site) does not support this printing-as-a-whole feature.

pavan said...
This comment has been removed by the author.
pavan said...

thanks for the Reply Dr.M.Elkstein...actually i am doing my masters thesis on REST and SOAP. I also ready some papers, i stuck at the update in REST. Is it ok, if i ask you some doubts- only if you are comfortable.

Your Document is really interesting and nice . Thanks one more time.

Dr. M. Elkstein said...

Hello again Paven,

Please send your comments to me by email. I'll reply only if I can, though.

KeepingItSimple said...

Thanks for a very simple introduction post of ReST.

This was AWESOME.

brad said...

Can you please provide a single document for this site (PDF etc)?

Its awesome.

zerjyo said...

Excellent tutorial.

I am starting to learn about the Open Services for Lifecycle Collaboration (OSLC) and REST is one of the 3 columns of the description.

I am the developer in charge of the installation of the Rational Team Concert product, it is just a great tool to collaborate using REST.

I will recommend this page to all my partners.

casey said...

How do I contact Dr. M. Elkstein? I may have a project for him.

thanks!

Dr. M. Elkstein said...

Hello casey,

Thank you, but I am happily employed at the moment.

vbmade2000 said...

Very nice tutorial about REST.
Thanx Dr. M. Elkstein for posting such nice tutorial.

Antonio said...

Yesterday I started looking for some information about RESTful. I read many blogs and tutorials, but this was the most liked, what made ​​me understand the big picture.

Thank you for sharing your knowledge

Scott said...

'Thus, REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations.'

I hope by this stement you are not implying a 1-1 mapping of POST/GET/PUT/DELETE to CRUD.

Dr. M. Elkstein said...

Hello Scott,

Not all all. No such mapping was implied, and if anything of the sort can be understood from my text, it's a simple misunderstanding. REST does use HTTP for all CRUD operations, but more often than not, only GET and POST are used.

JOBBER said...

Really nice articles.. Thanks a lot

Murali said...

Thanks for Posting a high Level overview of the Rest Architecture , i am hearing it lot nowadays.

I am working on the WEbservices with soap UI , onc quick question can Rest be used cross platform
like can we call a Java Api and then a Dot net service ..

just a thought...

Murali said...

A Very Neatly written write up for Rest

Dave said...

Dr Elkstein,

Nice tutorial! Short, clean, and clear...or as my linear programming professor used to say "Terse and Pithy". :)

Thank you!

yoda said...

Very nicely explained...good work !
Like Bruce Eckel in Java, you also manage to explain things clearly and simply. I'm sure a lot of beginners will benefit.

Grey said...

Nice blog.

How would you do internationalization (i18n) with REST? In the SOAP world, there is WS-I18N (W3C Working Draft, dated April 2008). What is available for REST?

Sandeep Meher said...

Hi Dr.M.Elkstein,
Thanks for this fantastic tutorial! I had gone through numerous articles but this series is the most practical for starting with REST.
Regards,
Sandy

Saurav Shrestha said...

Dr Elkstein,

Thank you for writing this tutorial. I'm just getting started with REST and have been tearing up my hair as to how to use it and with your posts as guidance I have successfully set it up.

Once again thank you for your help.

Computer For Dummy said...

This is great.
I get a lot of information from here.
Thanks for this information.
Computer Information