Re: API versioning
"Eric J. Bowman" <[email protected]>
| Newsgroups | gmane.comp.web.services.rest |
|---|---|
| Organization | Bison Systems Corporation |
| Message-ID | <[email protected]> |
Jørn Wildt wrote: > > My question is though - from where does the client get the > information it needs to extract, say, the order sum, delivery > address, order lines quantity and so on from the generic payload? > From hypertext. NOT from knowledge of resource type coupled via custom media type (vnd.order*). It seems like you're asking how to inform the client that this resource type is "order" -- which is simply not relevant to REST, where the only client knowledge required is of the *interface* to the resource, not the *meaning* of the resource. If my order-form <table> has a <th>quantity</th> column, then the quantity of any item ID is the corresponding <td>, i.e. you code the client with the XPATH expression which yields the answer you're looking for, assuming XHTML. If Xforms is used, this XPATH expression is right there in the form control binding, i.e. a self-documenting API. > > Actually, I would argue that a generic media type is more "typed" > than a domain specific media type. Okay, that sounds like rubbish, I > know - but let me explain: > > - as I stated above, a domain specific media type lets you derived > useful information from a resource without making any assumptions > about its underlying type. > I might agree with that, if generic media types didn't have extensibility mechanisms like, oh I dunno, link relations... AFAIC, domain-specific media types _are_ assumptions about the underlying type, i.e. an "order" is too unique a snowflake to express generically; what other conclusion *can* be drawn about how vnd.order* types are used in practice? > > - whereas a generic media type forces the client to magically assume > the resource has a specific type with specific properties you can > extract from the generic payload. > OK, this is where these discussions always lose me. A browser needs to know *nothing* about resource type, to allow a user to place an order from, like, a bazillion different websites. In REST, the client just needs to know how to manipulate generic hypertext controls. What is it about order processing that makes folks think the client needs to know that it's processing an order? -Eric Now playing, ***** stars for sure: http://archive.org/details/gd1970-11-06.aud.evans.3338.sbefail.shnf