What are the main patterns and/or attributes that make an application RESTful?
views:
104answers:
7A plain MVC partterns is good.
Also you have to make sure you split your things into real model (for example for a blog it would be post/comments)
Also you have to use all the HTTP verb so PUT/DELETE/POST/GET.
I think this might answer your question: Representational State Transfer
Doing things RESTfully is actually hard.
At the end of the day, the big attributes are:
1 - URIs represent resources, not actions 2 - HTTP verbs describe what action to take
ie:
GETing http://www.example.com/something/1 will return the something identified by 1 POSTing http://www.example.com/something/1 will update it PUTing http://www.example.com/something will create a new something
3 - The responses to things like GET requests should document other places the client can go.
If a client asks for http://www.example.com/movies/1 (via GET), the response should contain elements that point the client to things related. Like http://www.examples.com/review/movie/1 (which might list reviews of movie #1
This is really rough -- spend a day googling around and reading. Then try to figure out who's really talking about REST, and who's confusing it with basic RPC stuff with simplified URL schemes.
To start with, a RESTful web service must not violate any of the following constraints (described in detail in Roy Fielding's seminal dissertation):
- client-server
- stateless
- cacheable
- uniform interface
- layered system
Of these, 'uniform interface' is particularly important.
A fundamental consideration in REST is to strictly observe the division between "side effect free" methods and ones with side-effects.
Understanding the difference between PUT and POST, aka understanding what idempotency means.
REST != RPC. There seems to be a lot of resources on the web (such as this one) that seems to think that just because there are multiple representations of a resource, then it is restful. Links such as /API/User/GetUser are not restful.
Hypermedia as the Engine of Application State (HATEOAS). Interpreting REST with a clear grasp of this single constraint will make everything else about REST an order of magnitude easier to understand.