views:

43

answers:

2

I was reading about a blog application that was described as RESTful.

If someone told you their web application was RESTful, what types of features would you assume it contained, to differentiate it from a non-RESTful web application?

+2  A: 

Nothing much to do with features, just how they're accessed.

The basic difference is that SOAP is based on verbs, so you'd have functions such as AddRecord. REST is based on nouns, so you'd just PUT a version of the document that has an additional record.

Steven Sudit
+5  A: 

When talking about a web site rather than a web service (which i assume you are), 'RESTful' is a fairly weak term, because the web is a fundamentally RESTful system anyway. Points which distinguish a truly RESTful website from others include:

  • Use HTTP authentication on every request for access control; there should be no login page

  • Expose only bookmarkable URLs that look the same (if accessible) to all comers; there should be no /myaccount, only /account/Chuck

  • Not keep any user state in hidden session variables, but only in the URL; if you change your friends page view from summaries to titles only, there should be a change in the URL, and subequently visiting either of those URLs should show the page in the corresponding way

Other than that, it's mostly a question of being web-like in the way that all sites are: all pages can be reached by traversing links (including submitting forms) from other pages (you never have to munge a URL by hand or know a magic secret URL), responses contain metadata describing what they are (the content-type in the HTTP response), etc.

Tom Anderson
Would you say that, in order to be truly RESTful, a site should not use querystrings and should probably use something like MVC?
Steven Sudit
@Tom There is really no difference between web sites and web services from the perspective of REST. The rules you describe for websites apply just the same to web services.
Darrel Miller
@Steven querystrings are just as valid as path segments for identifying resources. The notion of a RESTful url that only contains path segments is a misunderstanding based on an outdated URI RFC.
Darrel Miller
@Darrel Strictly, that's true. But there are a lot of RESTful features which are taken for granted for websites but not for web services, and i didn't talk about those here. Oh, and you're spot on about query strings, of course. The structure of the URLs has absolutely no bearing on RESTfulness, only their semantics. URLs are opaque to REST, but it's a popular misunderstanding to believe otherwise.
Tom Anderson