REST (Representational State Transfer)
REST is An Architectural Style
It uses the following standards:
* HTTP
* URL
* XML/HTML/GIF/JPEG/etc (Resource Representations)
* text/xml, text/html, image/gif, image/jpeg, etc (MIME Types)
The Whole WWW is a REST system!
RESTful
RESTafarians
HTTP methods: PUT, GET, POST and DELETE.
database operations: CREATE, READ, UPDATE, DELETE (CRUD)
URI -> Resource
REST Is a Conversation
The verbs of the REST conversation are the aforementioned request methods, while the nouns are URIs, A URI should be only a pointer to a resource.
e.g.
GET "/books/1"
DELETE "/books/1"
URI,URL and URN
A Uniform Resource Identifier (URI), is a compact string of characters used to identify or name a resource.
A Uniform Resource Locator (URL) is a URI that, in addition to identifying a resource, provides means of acting upon or obtaining a representation of the resource by describing its primary access mechanism or network "location".
Uniform Resource Name (URN) is a URI that identifies a resource by name in a particular namespace. (e.g. urn:isbn:0-395-36341-1)
Web service, a software system designed to support interoperable Machine to Machine interaction over a network.
Remote Procedure Call (RPC)
REST Is Design
A clear approach to controller-design that’ll reduce complexity for the implementer and result in an application that behaves as a much better citizen on the general web.
REST gives us a framework for simple but extensible application design.
ActiveResource
RailsConf Keynote: David Heinemeier Hansson Video the World of Resources
online video: http://www.scribemedia.org/2006/07/09/dhh/
download address: http://downloads.scribemedia.net/rails2006/01_dh_hansson.m4v
(the slides http://www.loudthinking.com/lt-files/worldofresources.pdf)
David Heinemeier Hansson’s blog on ActiveResources
http://www.loudthinking.com/arc/000593.html
script/generate scaffold_resource
http://www.xfront.com/REST-Web-Services.html
http://en.wikipedia.org/wiki/Representational_State_Transfer
http://en.wikipedia.org/wiki/Uniform_Resource_Identifier
http://en.wikipedia.org/wiki/Web_service
Rails Cookbook
轉載請註明: 轉自船長日誌, 本文鏈接地址: http://www.cslog.cn/Content/rest-and-activeresource/zh-hant/