Welcome to MSDN Blogs Sign in | Join | Help

How to REST in a nutshell

If you hang out with the web 2.0 kids long enough you'll inevitably hear the word REST/RESTful.  I've gotten this question enough from the CS students I work with to create a little knowledge nut right here:

REST = Representational State Transfer

In a canonical desktop application we have objects (ie cyBlog) and methods (getPost()).  If I want to get a post from Cy's blog I'd write something like cyBlog.getPost().  Now, to do anything with the actual post I'd probably store a local copy and pass it around internally.  This happens so much with the web we've stared to look at everything as an object.  So, rather than doing a method call to get cy's post I'd go to a resource - www.cyBlog.com/getpost (yes - the entire world wide web is RESTful).  This makes it a TON easier for a more diverse and rapidly changing set of services interaction.  I really don't care who or what you are as long as you can use HTTP to ask me for information.  Also, if the connection is lost - I can just retry at the same URL - no state information is lost (in RPC if you loose the connect you're back to square one).

How is this different than Remote Procedure Call (RPC)?

RPC looks like the classic cyBlog.getPost() way of grabbing data.  You just open a client connection first.  In RPC think of everything as a verb - get this set that.  REST is all noun based - go to get or set as a URL. 

Published Wednesday, June 18, 2008 9:17 AM by Cy Khormaee
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# a-foton » How to REST in a nutshell

Wednesday, June 18, 2008 9:46 AM by a-foton » How to REST in a nutshell

# re: How to REST in a nutshell

This question just came across the wire (and by wire I mean my inbox):

"""

Is RCP more secure because the entire "process" is completed within a single communication?

I'm thinking that REST could be "fooled" when reconnecting to (what it "thinks") is the "same" URL.

"""

Quick answer - yes - but only if you have a bad authentication process.  Every time you open a new connection it's important to verify both sides of the transaction are who they say they are - this is a pretty good walk through of REST authentication:

http://www.berenddeboer.net/rest/authentication.html

That being said, a lot of REST services are meant to be completely open and/or are just quick and dirty - so the potential for this kind of spoofing attack is certainly greater.  Security through obscurity is right out the window ;)

Wednesday, June 18, 2008 10:17 AM by Cy Khormaee

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker