Roger wrote:
> Those are the two ways that I see for implementing the purchase parts
> Web service. Are there other (better) ways? Any comments? /Roger
I'm not sure where my version of this verb/URI issue stands, but here is the way
I have designed it in my own efforts. As I mentioned before, I have a
pre-developed set of resource types, namely methods, components, topics, queues,
etc that are published in a node's hierarchical namespace. Each type is a
different type of abstraction, but all of them have methods that can be invoked.
Here is the way I see how each of the HTTP methods allow nodes to interact with
them:
------
HTTP GET - allows you to ask a node to return information about a resource at a
URI. In the case of a method resource, the results of a HTTP GET with
/Fruit/Apple/Washington/harvest might look like this:
<item key='harvest' type='method'>
<list>
<item key='baseName' value='harvest' />
<item key='baseName' value='cosecha' scope='/Language/ES />
<item key='optionalParam' type='boolean'>param5Name</item>
<item key='requiredParam' type='singleText'>param5Name</item>
<item key='requiredParam' type='multiText'>param4Name</item>
<item key='requiredParam' type='singleSelect'>param1Name</item>
<item key='optionalParam' type='multiSelect'>param2Name</item>
</list>
</item>
So a GET really only lets you to discover the resource. Obviously, if you had a
XSL converter, the above XML is easily converted into an HTML form that a
browser can use to can actually invoke the method.
HTTP PUT - instead of getting a pre-existing resource like the one above, it
allows you to effectively copy a resource in its current state to another node.
You are effectively publishing it on the destination node.
HTTP POST - in the case of method resources, like the one above, this is as
close as you get to the "verb" notion, where POST has optional/required
parameters that have been specified in the body and/or request line's query
string.
HTTP DELETE - deletes the published resource at the URI.
------
In essence, even though the URI provides you with the location of a method
resource on the network, it's not pointing to a verb per se. It is pointing to
the verb "as a noun". Once you POST to it, then that's when you submit
information to the resource being hosted by the server, and in this case, the
harvest method uses it to invoke behavior.
How far on or off base is this approach to REST? Do the REST purists out there
agree with it? Would this be more noun-like or verb-like?
Thanks,
Philip