having trouble understanding them

Well, the title more or less says it all. I sort of understand what REST is - the use of existing HTTP procedures (POST, GET, etc.) to facilitate the creation/use of web services. I'm more confused on what defines what a web service is and how REST is actually used to make/expose a service.

For example, Twitter, from what I've read, is RESTful. What does that actually mean? How are the HTTP procedures invoked? When I write a tweet, how is REST involved, and how is it any different than simply using a server side language and storing that text data in a database or file?


This concept is also a bit vague to me but after looking at your question I decided to clarify it a bit more for myself.

please refer to this link in msdn and this.

Basically it seems that it is about using http methods (Get/Post/Delete) to identify the exposure of resources the application allows. For example: Say you have the URL :

http://Mysite.com/Videos/21 

where 21 is an id of a video. We can further define what methods are allowed to this url - GET for retrieval of the resource, POST for updating/ Creating, Delete for deleting.

Generally, it seems like an organized and clean way to expose your application resources and the operations that are supported on them with the use of http methods


You may want to start with this excellent introductionary writeup. It covers it all, from start to end.


A RESTful architecture provides a unique URL that defines each resource individually and infers through HTTP action verbs the appropriate action to do for the same URL.

The best way I can think to explain it is to think of each data model in your application as a unique resource, and REST helps route the requests without using a query string at the end of the url, eg, instead of /posts/&q=1 , you'd just use posts/1 .

It's easier to understand through example. This would be the REST architecture enforce by Rails, but gives you a good idea of the context.

  • GET /tweets/1 ⇒ means that you want to get the tweet with the id of 1
  • GET /tweets/1/edit ⇒ means you want to go to the action edit that is associated with the tweet with an id of 1
  • PUT /tweets/1 ⇒ PUT says to update this tweet not fetch it
  • POST /tweets ⇒ POST says i got a new one, add it to the db, i cant give an id cuz i dont have one yet until i save it to the db
  • DELETE /tweets/1 ⇒ delete it from the DB
  • Resources are often nested though so in twitter it might be like

  • GET /users/1/jedschneider/1 ⇒ users have many tweets; get the user with id of jedschneider and its tweet id 1
  • The architecture for implementing REST will be unique to the application, with some apps supporting by default (like Rails).

    链接地址: http://www.djcxy.com/p/12328.html

    上一篇: MVC RESTful由设计

    下一篇: 无法理解它们