--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
Gruß,
Felipe
{
"links":{
"self": { "href": "/orders" }, "next": { "href": "/orders?page=2" }, "order": { "href": "/orders{?id}", "templated": true }
},
[{...order 1...}, {...order 2...}, ...}]
}
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
On 13 Feb 2013 23:38, "erewhon" <keith....@gmail.com> wrote:
>
>
> Interesting -- we're building out a new API that is primarily M2M though we're targeting more than a single type of platform (e.g. iOS vs Android tablet). Some platforms know how to deal with "video", others do not.
>
> The API is almost RESTful as we haven't fully embraced the hypermedia constraint: I've chosen the application/hal+json media type (thank you for your efforts in this regard :) but I'm not linking everything in our response. For example, when we return a paged list of results I'll use the "_links" section to specify next/prev pages as well as a template for accessing individual items, but we won't actually link every single result that is returned in the collection. For example:
>
> {
>
> "links":{
>
> "self": { "href": "/orders" },
> "next": { "href": "/orders?page=2" },
> "order": { "href": "/orders{?id}", "templated": true }
>
> },
>
> [{...order 1...}, {...order 2...}, ...}]
>
> }
>
>
> So the actual collection we return is not part of the "_embedded" object as per the specification. Instead we return the list of orders without any link relations and let the client rely on the template to access a specific order (assuming they have out of band knowledge about the "order" relation).
>
> To be honest I'm not sure if it makes sense to do it this way or if we should just fully adopt HAL and use the embedded resources with linking. I'm not convinced client applications will benefit significantly from the additional linking effort...
>
Its really up to you. Fwiw, by breaking with hal conventions your responses will be less suited to consuming with all of the hal client libraries out there
> Anyway, back to inheritance ... you mention the use of "type", which is described in the json-hal-05 draft as a means for specifying the "media type" of the "target resource". Wouldn't I be abusing the "type" parameter by specifying something other than the actual media type of the returned representation? It seems strange to use a link relation here.
>
I meant use the type link relation which is different from the type link property.
Hope that makes sense?
Cheers,
M
Its really up to you. Fwiw, by breaking with hal conventions your responses will be less suited to consuming with all of the hal client libraries out there
> Anyway, back to inheritance ... you mention the use of "type", which is described in the json-hal-05 draft as a means for specifying the "media type" of the "target resource". Wouldn't I be abusing the "type" parameter by specifying something other than the actual media type of the returned representation? It seems strange to use a link relation here.
>I meant use the type link relation which is different from the type link property.
Hope that makes sense?
The first option has the benefit of being easier to manage on the server side (less changes to support new inheritance) but can get complicated and "noisy" in the serialization (e.g. many serializers treat the emission of a "type" value as an on/off switch so you end up with JSON strings that are littered with type information and usually that type information is mostly useless except for the trailing name of the type, not the fully qualified bits).The second option addresses the noise in the JSON (though it adds another level of depth to the structure). To be honest I think emitting type information is the preferred solution ... I've gone down the path of plumbing serializers to clean up what actually gets emitted (e.g. instead of "$type": "com.foo.products.video" we can just emit "$type": "video" and in cases where there is no inheritance do not emit "$type" at all).
"Many serializers treat the emission of a "type" value as an on/off switch so you end up with JSON strings that are littered with type information and usually that type information is mostly useless except for the trailing name of the type, not the fully qualified bits"
Thanks for clarifying.
So over the weekend I've been re-re-reading (yes, that's not a typo) Roy's Rules of REST[1] and this time I think I managed to grok more than I had in prior reads. However I'm still trying to decipher the exact meaning of "typed resources" and also "irrelevant and invisible to the client") in this context:
A REST API should never have “typed” resources that are significant to the client. Specification authors may use resource types for describing server implementation behind the interface, but those types must be irrelevant and invisible to the client. The only types that are significant to a client are the current representation’s media type and standardized relation names.
But it sounds like what you are doing might be in conflict with that? (And saying "Yes, but it doesn't matter as we don't intend to be doing REST" is an okay answer too.)
A REST API must not define fixed resource names or hierarchies (an obvious coupling of client and server). Servers must have the freedom to control their own namespace.
So this bring up a lot of thoughts I'm still trying to grapple with re:REST.Let's define some terms so we can make sure we talking about the same thing.
So your Server serves your JSON files and they contain reference to "video" and "clothing." What automated actions do you expect your User-Agent to take on those entities? Can you give some examples?- Server: That device which servers your JSON files and responds to HTTP requests.- User-Agent: The client software that download and interprets the JSON and takes action on the products it contains.- User: A human that is somehow ultimately involved in your process (or maybe not?)
Assuming the following as a simple data example, what would your User-Agent need to do differently with each product? Is there something you need to do with these attributes that differs from SKU, QtyOnHand or QtyOrdered and Price?
{
{ "type":"video", "runtime":"15:00", "format":"mp4", ... },
{ "type":"clothing", "color":"red", "size":"XL", ... }
}
-MikeWho is the User in your system? Is this API to support a shopping cart or some totally automated process such as restocking?I guess I'm trying to understand how the User-Agent would use the information Foo.Products.Video and Foo.Products.Clothing? That seems like it is Server-side concern?
So your Server serves your JSON files and they contain reference to "video" and "clothing." What automated actions do you expect your User-Agent to take on those entities? Can you give some examples?
I guess I'm trying to understand how the User-Agent would use the information Foo.Products.Video and Foo.Products.Clothing? That seems like it is Server-side concern?
The details of the use cases are going to vary; it might be useful to display video products differently from clothing.
<snip>
But the client application does need to understand how to differentiate between different resources that are closely related. Basically using properties of the resource as logical input to application behaviour.
For example? Sorry if I'm pushing so hard for details but it's the details that can validate if a solution can work or not. Can you give my two hypotheticals for video vs. clothing?
Either way, I'm thinking about the more abstract notion of how to deal with this scenario. If there is a general pattern/practice to addressing the desire to expose a single URL that can serve more than one "type" of resource.
Based on another read of R3 (Roy's Rules of REST) I'm thinking that to be RESTful your User-Agent has to natively understand what "video" and "clothing" mean OR you need content types that are specific to each of your product types and you either have your User-Agent upgraded to know what those mean and/or you do code-on-demand to provide the intelligence need for clients to process (though I currently think code-on-demand is mostly idealistic vs. practical on the modern web, though more practical today with the rise of Javascript than it was 10+ years ago.)
I think Roy's comment here[1] is probably the most insightful thing I've read from him (insightful for me, emphasis mine):
The media type identifies a specification that defines how a representation is to be processed. That is out-of-band information (all communication is dependent on some prior knowledge). What you are missing is that each representation contains the specific instructions for interfacing with a given service, provided in-band. The media type is a generic processing model that every agent can learn if there aren’t too many of them (hence the need for standards). The representation is specific to the application being performed by the agent. Each representation therefore provides the transitions that are available at that point in the application.
So for media type you might instead use:
List: application/vnd.erewhon.productVideo: application/vnd.erewhon.productClothing: application/vnd.erewhon.productOR you might use:
List: application/hal+json
Video: application/vnd.erewhon.videoClothing: application/vnd.erewhon.clothing
What I don't want to do is map each of "video" and "clothing" to their own URLs:/products/video/products/clothingThe single address "/products" is more maintainable as our product hierarchy expands and facilitates things like searching. So I think it becomes necessary to share the "type" of product with the client application. We could express a collection of different products by introducing a partitioning scheme: "{products: {video: [{...},{...}], clothing: [{...},{...}]}}" but this doesn't really change that the client needs to understand these types if they want to deal with the information and that layout is ugly and less natural than embedding the type information right into the JSON result: "[{_type:"video",...},{_type:"clothing", ...}]". This JSON layout is far easier to work with in other scenarios such as ordering a list.
Okay, so based on this your preference is:
application/vnd.erewhon.productAnd not:
application/hal+json
This tells me that if you put "video" or "clothing" into a "generic media type" you are doing it wrong according to R3. To wit[2] (emphasis mine):
So I think in your use-case the media type "application/hal+json" would be considered a generic media type because HAL doesn't understand "video" or "clothing." Your media type could be *based* on HAL if you wanted it to be, but to be RESTful I still think it needs to be it's own media type with it's own "Content-Type" string. Consider Roy's comment[3]:In terms of testing a specification, the hardest part is identifying when a RESTful protocol is actually dependent on out-of-band information or if the authors are just overspecifying things for the purpose of documentation. What I look for are requirements on processing behavior that are defined outside of the media type specification. One of the easiest ways to see that is when a protocol calls for the use of a generic media type (like application/xml or application/json) and then requires that it be processed in a way that is special to the protocol/API. If they are keying off of something unique within the content (like an XML namespace declaration that extends the semantics of a generic type), then it’s okay. Usually, however, what they do is assume that the response has a specific structure beyond that defined by the media type. When the structure changes, the client will break.Every media type defines a default processing model. For example, HTML defines a rendering process for hypertext and the browser behavior around each element.
So I think where I'm left in all this is:
- A "_type" in the resource is a good idea, particularly if you need to return representations in non-hypermedia formats.
- A client application may be able to handle all product types generically but requires out of band knowledge to provide custom behaviours to particular types of products.
- A "type" relation may be included in the "_links" section of the HAL response (assuming HAL). The type relation may point to a resource that provides documentation about the types provided by the /products resource. I'm not sure if this kind of documentation could be used to improve/reduce the out of band knowledge shared with clients. I'd be curious to hear more thoughts on this if anyone has insight.
Hmm. Consider the following; rather than define "types" for "video" and "clothing" what if you instead define "traits" that are "known" aspects of your media type and that your clients are able to understand. For example:
- Overview Video; for a video that's a trailer, for a clothing item it might be a video so a model wearing the clothes.
Now you one generic media type that simply describes the traits of your products and then your client apps can know what to do with those traits. If it has an Overview Video then your client can offer to let them view it. If it has multiple Colors then the client can allow the user to select a color and possible view an image of the product in that color.- Images; For a video they might be screencaps, actor headshots, etc. For clothing "Front View", "Read View", "L/R Side Views", etc. So images would have a generic value "imageType" that the would allow the agent to show the User what types of images are available and to show the images by image type.- Color & Size: Applicable for clothing but probably not for video.- And so on.
I think one of the ways you'd discover traits is to think about what you want your clients to do with the product information, and then tease the traits out of that insight. If you want to be able to view a product using a 3D 360 degree viewer then the data and images you need to enable that viewer becomes part of your set of product traits.
Traits as fundamental, unchanging aspects of your products; "types" are really a somewhat arbitrary grouping that we humans use to divide and conquer too much information to grok at one time. This insight is coming from someone who built and grew an early e-commerce retailer that made it into the Inc 500 where much of what I spent my time on in the early days was product categorization. I learned that categorization changes based on the perspective of the observer and you can never get categorization fully correct. On the other hand, traits are fundamental and do not change (or at least should not. I wish I had had this insight in 1994.)
In addition to the above you can also include the string of "video" or "clothing" as a 'category' attribute of a project but those become just labels and not processing instructions. Adding new "types" really just means describing in meta-data on your Server what traits those new types have and then serving the information about those traits. If you discover the need for new traits you evolve your media type in a backward compatible way.
Does that analysis change what you are thinking about tackling this problem?
-Mike
For example? Sorry if I'm pushing so hard for details but it's the details that can validate if a solution can work or not. Can you give my two hypotheticals for video vs. clothing?
Okay, so based on this your preference is:
application/vnd.erewhon.product
And not:
application/hal+json
rather than define "types" for "video" and "clothing" what if you instead define "traits" that are "known" aspects of your media type and that your clients are able to understand.
"types" are really a somewhat arbitrary grouping that we humans use to divide and conquer too much information to grok at one time
To be honest it's a contrived scenario but it could be as simple as "for clothing the client application uses layout 'X' and for video the client uses layout 'Y'", where X and Y are two different user interface constructions. There are probably other behavioural differences as well that are yet unclear to me in my real use case at work. Sorry, maybe my examples suck. :\
Who will be building the client applications? Your company and/or potentially anybody?
Okay, so based on this your preference is:application/vnd.erewhon.productAnd not:application/hal+jsonNo, I'm using application/hal+json.
Sorry, I think I mis-explained. What I was saying was I think that if RESTfulness is important then according to my reading of R3 you really should be using a custom media type and not a generic one like HAL. IOW you may be using HAL but I'm now questioning if that's really the best solution for your use-case.
The JSON examples I provided were just snippets to show how one might represent a list of products that are differentiated. The choice of differentiating our products into distinct groups is a key aspect of our business that we have modelled right through our system. It's definitely not arbitrary and it's important that clients *know* about this differentiation.
If the product groups are indeed not arbitrary then is sounds like you should be defining a new media type for each of your product groups and that your use of HAL should only be used to capture the common elements.BTW, I think you misunderstood my use of the term "arbitrary." I meant it in the grand scheme, not specific. I might have a category called SUV for my vehicle but over time new subcategories emerge and new cross-over categories emerge that muddy the initial categorization.We used to buy "records" on vinyl but today with iTunes single song purchases the concept of a "record" is arbitrary. IOW, I was not saying that your categories are arbitrary as I'm sure your categorization was based on external factors but that instead basic nature of human categorization is arbitrary and it morphs and evolves over time. I was comparing that with traits like number of wheels or time length of recording; these are much less likely to morph over time.
rather than define "types" for "video" and "clothing" what if you instead define "traits" that are "known" aspects of your media type and that your clients are able to understand.That's exactly what the "_type" property is allowing me to do. You call it a "trait" but the key here is conveying this information as part of the resource. Whether I call it "_type", "ProductType", "Category", etc ... it's a means for publishing a model that can be differentiated.
Hmm. Maybe it's me misunderstanding but as I read that I think that I must not have really explained what I meant by a trait. A trait is something like "color", not "clothing."
Suppose, for example, that you're an online music company and your product searches can turn up both vinyl record results along with entire compilations (like a multi-CD collection). I can imagine such a company might want to present the multi-CD collection in a different way, possibly highlighting the collection name and a specialized layout for options relating to how the user can access the digital content (if any).
For that I would say you have a trait of a "collection" which can be comprised of dependent products (things you can only get in the compilation) and independent products (things that can be sold separately.)Also I would see other traits and being physical products with things like medium (vinyl vs. cd), size, weight, qty in stock, and digital with a filesize.And of course I would see traits for labels where you can describe then as "Multi-CD compilations" and possibly even meta-data on the server end where you can say what traits that a grouping might have.
The client application needs to understand the "type" of the product because it's a key aspect to the application logic of the client. It's also core to the business. You might imagine that a client application simply searches for a property that exists only for collections (e.g. "CollectionName"). But why let the client make up its own rules when we can inject something reliable into the resource that allows the client to make an unambiguous and predictable choice about its handling?
The reason not to is to avoid coupling to existing ideas about types that may change over time.
Different client apps can choose to use different rules, but facilitating the identification of these resources seems like an important design decision."types" are really a somewhat arbitrary grouping that we humans use to divide and conquer too much information to grok at one timeOh I don't know, typing is a pretty useful and necessary exercise if you're going to make sense of your domain...! ;)
Yes, types are very helpful for us humans to grok things but it's an unreliable basis for which to architect software. Categories evolve which means that the software is structured around categories has to evolve or it's not longer useful. And since you are architecting a distributed solution I think it would be especially important that you formats be as reliable over time as reasonably possible.
But if it helps, change "_type" to "Category". We still have the same problem of modelling differentiated resources: how do we provide enough information to the client so that they can use the result effectively?
I come back to "traits" identified in your media type as being the solution. Your clients can operate against these media-type specific traits, and if you've identified your traits in a manner that they don't change over time (although I think you could add to them in a manner that old clients could ignore) then you'll have a more resilient API.
There might be a corollary here: should inherited models be their own resource? (so /products/clothing, /products/videos rather than everything under /products).
I think asking about inheritance is serendipitous because in OOP the "fragile base class" problem and the need for but problems with multiple inheritance are two of the reasons so many have realized OOP is not a panacea. It's really hard to model classes such that they don't need to change and I think that's what you are trying to do with your types/categories.Two things I've noticed recently that are evolving to address the issues in OOP are Structural Typing[1] which I learned about because of TypeScript [2] and Traits in PHP[3] which is where I stole the name I used above. The idea of both are to identify the independent aspects of an object and allow them to be mixed & matched as opposed to creating a single rigid named class. I think that collective learning can apply to your use-case too.
This still leaves you with the requirement that your link relations will need to differentiate clothing and videos, but I'm not sure this has actually achieved anything. Your response to a search under /products will still return a collection of embedded resources (assuming HAL) that distinguish between the types. My suggestion is simply that we promote the inheritance into the resource directly.
My current understanding based on my reading of R3 is that you can do one of those things IF you want to still be RESTful:
1.) A single media type that understands all potential product types; i.e. 'video' and 'clothing'. This by definition cannot be application/hal+json but would instead need to be something like application/vnd.erewhon.products. The obvious downside is that you have to evolve this and evolve your clients over time to know more and more about your product types.2.) Use application/hal+json for your list and then use a potentially unlimited set of other media types like application/vnd.erewhon.video and application/vnd.erewhon.clothing to represent your different product types. In your HAL document you would *not* include any reference to your media type other than "rel='type'" and not have any type-specific behavior because doing so would not be RESTful. Instead you would include URLs to the products which when requested would return media types that represent the product type. This also has the issue that you have to update your clients as time evolves but you could potentially do it in a module or even code-on-demand fashion where each module aligns to a media type and clients that don't have the required module to recognize a media type simply treat it as a generic product.3.) Use another form of application/vnd.erewhon.products that uses traits instead of types. Client behavior could change based on the traits (i.e. is there an Overview video? Does it have multiple colors? etc.) and if you add new traits the media type would need to be revised but clients could be instructed to ignore what they don't understand. In this case your "types" would be used to label attributes and/or collections but it would be the traits that would drive behavior, not types.IMO the best solution is #3 as I can see it being the most resilient to change and evolution over time but again, if RESTful is not important these concerns are less important; it all depends how much you value the attributes a RESTful system provides.
-Mike
The reason not to is to avoid coupling to existing ideas about types that may change over time.
/* domain-general design */
{ "order":
{
"id" : "...",
"address" : { "type" : "shipping", "street-address" : "..."},
"address" : {"type" : "billing", "street-address" : "..."}
}
}
You can see that the domain-specific address elements from the first example have been replaced by general “address” elements carry a “type” indicator to provide additional domain-specific information. The advantage of this design style is that the “address” elements could be applied to many other use cases within the problem domain (customer address, user address, supplier address, etc.) without having to modify the actual message design itself. In this way, your design takes on a level of modularity and reuse that makes supporting new domain-specific elements easier over time. In addition, client applications can create code that: 1) supports reusing these modular elements of your message design, and 2) is able to adjust to evolving use cases in the domain space more easily.
Thanks for the dialog. Even though it's your use-case I'm learning a lot being able to discuss it.I think we are converging to a similar understanding. I believe the issue here is "Pure REST" and "Pragmatic REST" although I'm sure Roy would argue that there is no such thing as the latter. To me the latter emerges when the real-world implementation concerns conflict with Pure REST. I was actually in the process of learning if you really can have Pure REST in the real world, beyond trivial use-cases of course.Looking at Pure REST my *current* understanding is that the only type information should be the media type specified in the Content-Type header except that "rel" attributes can indicate type ASSUMING that the client understand that those "rel" types are associated with the media type and the client understands them. That's why I was saying I using a generic type like HAL might not be Pure REST (but I could still be misreading R3.)But pragmatically using HAL and having your client understand the types in your representations might be just fine; it's certainly "more" RESTful (*cough* *cough*, sorry Roy) than most APIs that use "applications/json" and that do not provide links.
This kind of modelling exercise usually lands people in one of a few categories that are laid out pretty nicely in Mike Amundsen's "Building Hypermedia APIs with HTML5 and Node".
I've been eyeballing that book but haven't pulled the trigger yet because I've got so many other books in my "to read soon" pile. I think you've just convinced me to part with $15 and read it sooner than the others. :)
My approach would probably be characterized as a "domain-general" design ... here's a brief entry from the book:/* domain-general design */{ "order":{"id" : "...","address" : { "type" : "shipping", "street-address" : "..."},"address" : {"type" : "billing", "street-address" : "..."}}}
Did Mike's book really have that example, or did you para-type and misquote as that's not valid JSON? Did Mike maybe present the example in XML where the same layout would be valid? You can however turn the "address" property into an array but the sad part of that is it complicates your structure in cases where the is often just one:
{ "order":
{
"id" : "...",
"address" : [
{ "type" : "shipping", "street-address" : "..."},
{"type" : "billing", "street-address" : "..."}]
}
}
You could also do it this way with property names if you like but then your user agent needs to understand which properties are a collection of the same:
{ "order":
{
"id" : "...","shippingAddress" : { "type" : "shipping", "street-address" : "..."},"billingAddress" : { "type" : "billing", "street-address" : "..."}}}
I think one of the things that we as a community collectively need to do[1] is start to create standard media types for well-known use-cases that can be used across APIs and across individual projects, and they could be based on HAL or Siren or Cj or just be standalone JSON. People could always extend them in non-RESTful ways but at least we'd have interoperability at the 80% level and we wouldn't each have to reinvent so much.And I'm thinking that Roy would support this idea as RESTful, a least I believe that's what this quote[2] means (emphasis mine):
The media type is a generic processing model that every agent can learn if there aren’t too many of them (hence the need for standards). The representation is specific to the application being performed by the agent.
Looking at Pure REST my *current* understanding is that the only type information should be the media type specified in the Content-Type header except that "rel" attributes can indicate type ASSUMING that the client understand that those "rel" types are associated with the media type and the client understands them. That's why I was saying I using a generic type like HAL might not be Pure REST (but I could still be misreading R3.)
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks for the comments.
I am convinced you can use HAL because you are misunderstanding Roy.Looking at Pure REST my *current* understanding is that the only type information should be the media type specified in the Content-Type header except that "rel" attributes can indicate type ASSUMING that the client understand that those "rel" types are associated with the media type and the client understands them. That's why I was saying I using a generic type like HAL might not be Pure REST (but I could still be misreading R3.)This is where I think you are wrong.
Nope. Read below.
You can use HAL as the base format, meaning that you take HAL, and define which properties (or key/value pairs) are LEGAL withinYour specific media-type. You would create a application/vnd.products.video+Hal.
Seems you either misread what I wrote or you didn't read all of what I wrote (which is okay, I wrote a lot!) What you propose is effectively exactly what I said, I just didn't provide an explicit media type example:
On Feb 18, 2013, at 9:09 PM, Mike Schinkel <mi...@newclarity.net> wrote:I think one of the things that we as a community collectively need to do[1] is start to create standard media types for well-known use-cases that can be used across APIs and across individual projects, and they could be based on HAL or Siren or Cj or just be standalone JSON.
On Feb 17, 2013, at 6:00 PM, Mike Schinkel <mi...@newclarity.net> wrote:
So I think in your use-case the media type "application/hal+json" would be considered a generic media type because HAL doesn't understand "video" or "clothing." Your media type could be *based* on HAL if you wanted it to be, but to be RESTful I still think it needs to be it's own media type with it's own "Content-Type" string.
In my original emails I didn't emphasize those points like I did here; maybe that's why you missed them?
-MikeSo looks like we agree. :)
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
On the "type" or inheritance topic:Can't you provide the same logical resource with multiple representation? (media-types)If the client is just peocessing "products", he can just set "Accept: application/vnd.prodduct+HAL" and whatever he is requesting will be returned "as a product" or be a 406 if its not a product. That is the whole point of "content negotiation".
I'm not sure where to weigh-in on this thread, so I'll do the frowned-upon top-posting at a random point. :) Hopefully, this contributes something useful.
The key point here is that it is either the media type or the link relation defining this, not the resource.