--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
GET of /objects/robot/3333 returns:
{"robot" :
{"name" : "Mr. Roboto",
"links" : [ {"rel" : "kill", "href" :
"http://.../objects/robot/3333/kill", "type" :
"application/x-form-urlencoded}]
}
}
So, the idea is you get the representation of the robot, and the links
define what relationships are to the robot. One of the relationships is
"kill". You follow the link by posting to it:
POST /objects/robot/333/kill
death=slow
GET of /objects/robot/333/kill might return:
"This robot died a slow death"
The thing is here that the URL patterns are irrelevant, the URLs are
opaque, you navigate to them by linking.
> <mailto:bbu...@redhat.com> <mailto:bbu...@redhat.com
Sam Johnston wrote:
> Bill,
>
> Ironically Adrian wrote this post after being prompted by myself and
> Andy Edmonds from the OCCI-WG following criticism of exactly this
> approach. I definitely think links are a great way of satisfying the
> hypertext constraint (formerly known as HATEOAS) but I'm intrigued by
> what specific problems he has with this approach - e.g. "what could
> possibly go wrong"?
>
> In many (most?) cases the "actions" are not parametrised in which case
> the entity-body is empty, but the alternative, doing an empty POST to a
> parametrised (GET-style) URL, feels [very] wrong. While URLs should be
> considered opaque, I'm ok with using either semicolons or path segments
> ('/') to delineate actions:
>
> http://example.com/vm01;start
>
> but the following "feels funky":
>
> http://example.com/disk01;resize=20000
>
> I much prefer:
>
> POST http://example.com/disk01;resize
> size=20000
>
> So what we are currently doing for "actions" is a post/redirect/get
> pattern <http://en.wikipedia.org/wiki/Post/Redirect/Get> which I feel is
> quite elegant in that it allows us to handle more challenging realities
> such as asynchronous responses (e.g. returning HTTP 201 Accepted with a
> Location: header which can be monitored ala pubsubhubbub or polled).
>
Actually, i should have probably said this to Adrian:
POST /robots/333/deaths
death=slow
Then a GET of /robots/333/deaths might returna feed of what the
different deaths were and when.
As for pubsubhubbub, I don't like the reliance on Etag semantics for
polling. Feels like you're tunneling a protocol. I'd much prefer to
send a link back to the client telling it how it can get further (new)
data. I also don't like the reliance on Atom. Atom is fine for text
formats, not great for others. So, what I'm going to do is turn Atom's
(and messaging metadata in general, Atom's metadata isn't something
revolutionary) Into a set of headers and use multipart to send batches.
IMO, multipart is much more appropriate.
As for pubsubhubbub, I don't like the reliance on Etag semantics for polling. Feels like you're tunneling a protocol. I'd much prefer to send a link back to the client telling it how it can get further (new) data. I also don't like the reliance on Atom. Atom is fine for text formats, not great for others. So, what I'm going to do is turn Atom's (and messaging metadata in general, Atom's metadata isn't something revolutionary) Into a set of headers and use multipart to send batches. IMO, multipart is much more appropriate.
I postulate that regardless of java, python, curl, (name whatever you like), clients will be more efficient and capable on retrying transient failures if they are not required to store entities along with their requests. I'll challenge anyone to write a test in any language showing parsing entities as faster, more resilient to retries, or more scalable then 0-length requests using matrix or headers for things like this=true or that=2000 :)