In REST based architectures what's the difference between a resource and a method. Is there one?
A resource is something your application defines; they're very similar to objects. A method is one of the HTTP verbs, e.g., GET
, POST
, PUT
, DELETE
. They are similar to methods that get invoked on your resource.
I really recommend you read Architectural Styles and the Design of Network-Based Architectures (Dr. Fielding's dissertation, where he defines REST) and/or RESTful Web Services, which does a stellar job of showing how to put the theory into practice.
A resource is an interesting piece of state that a distributed application designer has decided to create a URL for.
http://example.org/foo
may be an identifier of a resource. As may,
http://example.org/foos?state=open
A method is an action or operation that can be performed on that resource. e.g.
GET http://example.org/foo
Reading RESTify DayTrader helped the concept sink in for me. He explains pretty decently how to go from a description of "actions" to a series of URIs and Methods on those URIs.