REST web service is a three-legged stool
The more I read and think about Rest web service, the more I am convinced that it is a three-legged stool. The three legs are: resources / noun, actions (get, post), and data output (plain text, xml, Jason).
For millions of regular users, REST is the web itself. We have been "getting, posting" since the web was born; for purpose-driven background XmlHttpRequest calls, REST is the service, pure data and transactions, stripped of other extraneous / superfluous dressed-ups.
On the implementation side, REST does not come in any pre-defined packages and has to be landed in any frameworks. It is indiscriminate of languages. It can be perl, python, php, asp, asp .net 1.x, 2.x, 3.x. It is an "archtechtural style" (whatever that means). The opposite of Soap service, which is rigidly defined and has a bloated set of rules and protocols.
Also the opposite of the heavy and verbose Soap service, REST is light and instantly to the point.
The three legs of the REST web service are:
- Nouns: each noun identify a type of resource.
For example:http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&query=pizza&zip=94306&results=2
A lot of REST talks stress using Nouns and avoiding verbs on the URL side, for example:
use
http://www.parts-depot.com/parts/getPart?id=00345
Note the verb, getPart. Instead, use a noun:
http://www.parts-depot.com/parts/00345
I do not why using getPart would be violating the principal. However, the noun url is a logical url not physical url, In .net, we cerainly can use URL rewriting to achieve this goal
2. Verbs (Get, Post ...).
With other unix-sort of languages, like perl, there are PUT, and Delete.
GET is obvious, it is the Select in database queries.
Why POST?
POST can be used to deal with large amount data, or form data.
3. Output
The whole purpose of REST is this: data representation. It can have many formats: plain text (though not recommended), XML, JSON. The list could be ever expanding.
So REST is a conceptual idea. It is a style, not implementation. It is evolving as the web is evolving. Like the web, it has some design principals: nouns, verbs, output.