Hi
all,
Background
First
posting here, so first a little background...
I am in the process of building a hypermedia based API adhering as closely as possible to the RESTful constraints. The API format is based on JSON [RFC4627], but also uses hypermedia controls in the form of Link Headers [RFC5988] and semantic serialisation of the Link Header for representation embedding purposes.
Question
My question is; in the design of a domain specific media type, what is the level of required specificity within the subtype field? Specifically, should the media type subtype include the type of resource for the particular representation?
Example
& Options
To expound a little, and in the vernacular of the well loved Restbuck's example from 'Rest in Practise', consider that I have 'order' and 'receipt' resources. I could propose Media Types of the following forms:
Form 1: Specific Media Types
application/vnd.restbucks.order+json
application/vnd.restbucks.receipt+json
Form 2: Use of Media Type Parameters (à la ATOM Pub [RFC5023])
application/vnd.restbucks+json;type=order
application/vnd.restbucks+json;type=receipt
Form 3: Payload Inspection
application/vnd.restbucks+json
... and expect that the user-agent inspects the payload to determine the resource type.
Research
Investigation into HTTP/1.1 [RFC2616] largely defers media type concerns to the MIME RFCs.
From RFC2045, I note the following pursuant points:
"The purpose of the Content-Type field is to describe the data contained in the body fully enough that the receiving user agent can pick an appropriate agent or mechanism to present the data to the user, or otherwise deal with the data in an appropriate manner. The value in this field is called a media type."
and,
"The Content-Type header field specifies the nature of the data in the body of an entity by giving media type and subtype identifiers, and by providing auxiliary information that may be required for certain media types."
I note from HTTPbis (draft) - 4.2. Representation Data:
"Content-Type specifies the media type of the underlying data, which defines both the data format and how that data SHOULD be processed by the recipient (within the scope of the request method semantics)"
which echoes the definition of RFC2045.
Further in HTTPbis, and within the context of Content-Type mismatch handling, there is the following:
"Implementers are encouraged to provide a means of disabling such "content sniffing" when it is used."
This is supported by a ticket raised (by Mark Nottingham) against the draft, which suggests that the use of 'sniffing' (payload inspection) is disallowed by the HTTP specification itself. The ticket somewhat implicates payload inspection as being undesirable in the general case.
Mark Masse refers to this inspection technique as a REST anti-pattern (here), specifically:
“This anti-pattern is a form of tunneling, that we might call "type tunneling" [sic] because it masks the content's actual "type" and reveals only its format.”
which resonates.
Roy
Fielding's edicts echo this approach; here:
“A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources and driving application state, or in defining extended relation names and/or hypertext-enabled mark-up for existing standard media types.”
and here:
“... media types are the only means we have for an HTTP sender to express the intent for processing a given message payload. While some people have claimed that recipients should sniff the data format for type information, the fact is that all data formats correspond to multiple media types. Sniffing a media type is therefore inherently impossible: at best, it can indicate when a data format does not match the indicated media type; at worst, it breaks correct configurations and creates security holes. In any case, sniffing cannot determine the sender’s intent.”
Status
Quo
I have investigated many “RESTful” protocols to understand how others have solved the issue and the general case appears to be “use payload inspection”! Arrrghhh!
There are notable exceptions, including:
Use of the "type" parameter in ATOM pub (RFC5023 - 12. The Atom Format Type Parameter),
Use of specific types in Oracle's Cloud API
Use of specific types in RunKeeper's API
Current
View
My current view is that whilst the status quo is to use the payload inspection technique, this is somewhat unRESTful. I'm inclined to conclude that “Form 1: Specific Media Types” is the way to go.
Question (again)
My question is; in the design of a domain specific media type, what is the level of required specificity within the subtype field? Specifically, should the media type subtype include the type of resource for the particular representation?
Many thanks for your time, and considered responses
Paul
Hi Paul,
There is a 4th form which is similar to 3 in that the media type
identifier is entirely untyped but, rather than inspection, clients
determine the resource type from their preceding context i.e.
inferring the type against the link relation which lead to the
resource's discovery.
So if the client follows <link rel="coffee-menu" href="..." /> then it
can interpret the response as a representation of a coffee menu. This
is distinct from Form 3 as no 'payload inspection' is having to take
place.
If you structure your application this way, there is actually no need
to use a domain specific media type at all. Instead you can pick a
general-purpose linking media type and govern and express your domain
specifics via set of link relations instead.
Cheers,
Mike
good to see you here!
ok, a diff question altogether....
why do you need this "type of resource" identifier at all? what is it
used for on the client?
mca
http://amundsen.com/blog/
http://twitter.com@mamund
http://mamund.com/foaf.rdf#me
> --
> You received this message because you are subscribed to the Google Groups
> "Hypermedia Web" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hypermedia-web/-/KTjnUOo1WHsJ.
> To post to this group, send email to hyperme...@googlegroups.com.
> To unsubscribe from this group, send email to
> hypermedia-we...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hypermedia-web?hl=en.
I think you are partly confused due to the term “content sniffing”. A media
type is used to be able to select a processor capable of processing a
representation. It is OK to have enough semantics **within** the
representation to distinguish between different entities.
IMHO you don't need to create a new media type for every single entity as
long as they have the same serialization format and thus processing model -
I would actually discourage such an approach. So, taking a JSON-based media
type as example, it would be completely fine to have a "type" property at
the top-level such as in:
{
"type": "order",
...
}
or
{
"type": "receipt",
...
}
to distinguish between the different entities.
Hope this helps,
Markus
--
Markus Lanthaler
@markuslanthaler
----------------
From: hyperme...@googlegroups.com
[mailto:hyperme...@googlegroups.com] On Behalf Of Paul Moore
Sent: Thursday, March 22, 2012 9:14 PM
To: hyperme...@googlegroups.com
Subject: Re: Media Type Design - Should the media subtype describe the
resource?
The "need" point is a good question. At the moment I use the 'rel' attribute to infer the 'nature of the resource'. The client is a user-agent that synchronises resources with server, and has an entirely separate (human) User Interface. The user-agent is therefore from the automaton category, rather than analogous to a browser per se. As an aside the client dereferences relevant controls to converge on a consistent object graph on the client.Whilst this is OK - and maybe even 'good', I'm concerned that a user who entered the API outside of a hypermedia control (i.e. followed a 'plain' link from an email) has no context on which to infer the 'nature of the resource' (see in part my discussion with Ian here) - hence the consideration of resource specific media types. Indeed, part of the MIME specification is to ensure that payload is adequately described by the media type, as part of the 'packaging'.
...
So I think if I don't "describe those bytes" I'll be breaking the 'self-descriptive messages' constraint.
<entry xml:base="http://services.odata.org/(S(S_ODATA_RO))/OData/OData.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:etag="W/"0"" xmlns="http://www.w3.org/2005/Atom" Xmlns:c="http://customUri"> <id>http://services.odata.org/(S(S_ODATA_RO))/OData/OData.svc/Suppliers(0)</id> <title type="text">Exotic Liquids</title> <updated>2010-03-11T22:47:21Z</updated> <author> <name /> </author> <link rel="edit" title="Supplier" href="Suppliers(0)" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Products" type="application/atom+xml;type=feed" title="Products" href="Suppliers(0)/Products" /> <category term="ODataDemo.Supplier" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <c:Road>NE 228th</c:Road> <content type="application/xml"> <m:properties> <d:ID m:type="Edm.Int32">0</d:ID> <d:Name>Exotic Liquids</d:Name> <d:Concurrency m:type="Edm.Int32">0</d:Concurrency> <d:Address m:type="ODataDemo.Address"> <d:Street>NE 228th</d:Street> <d:City>Sammamish</d:City> <d:State>WA</d:State> <d:ZipCode>98074</d:ZipCode> <d:Country>USA</d:Country> </d:Address> </m:properties> </content> </entry>
OTOH, I like Markus' POV. if the recipient will need some metadata
about the data, include that in the representation.
HTML:
<div class="order">
...
</div>
XML
<root type="order">
..
</root>
or just:
<order>
...
</order>
JSON
{
type: "order",
{...}
}
or just
{ order : {...}}
In the above examples, you write a single media type processor
(application/vnd.pkmoore+json) and let the local client handle any
specifics about the payload when (and if) that is needed.
Also, as Darrel points out, you'll not get a clear cut answer on this
topic as this issue is about _design_, not standards. Hopefully you'll
get enough cogent feedback to help you make an informed decision that
makes sense for your users/devs.
mca
http://amundsen.com/blog/
http://twitter.com@mamund
http://mamund.com/foaf.rdf#me
If it's a hypertext application, this sort of typing should be
unnecessary as it is redundant.. resource's shouldn't have to try and
'bite their own teeth' like this, it undermines any requirement from
clients to 'discover' resources by traversing through the application
and will only stand to induce a bunch of less evolvable clients to
your application as a result.
http://blog.stateless.co/post/13296666138/json-linking-with-hal
the "spec" lives here:
http://stateless.co/hal_specification.html
Notice, the XML variant enforces a generic <resource> element as the
root element for all resource representations to try and encourage
authors away from typing.
Cheers,
Mike
Assume we can use a mechanism like the "profile" link-relation
(http://dret.net/netdret/docs/draft-wilde-profile-link-00.html) for
describing the vocabulary used in any given resource representation. It can
be transferred in the HTTP "Link" header as shown below and can be applied
to any HTTP resource on the web:
Link: <some-url>; rel="profile"
Where "some-url" indicates the "profile" or "vocabulary" for the resource.
Back to media-types: as I wrote previously a media-type describes the
"processing model" for a resource representation where "processing" is the
"HOW to read the data" and "HOW to interact with it". It is NOT the "WHAT
data are we looking at" - that is for the profile/vocabulary to describe.
Consider two different images; both are image/jpeg, but one of them
represents a weather forecast and the other one represents a family photo.
In this case we could have:
Weather forecast:
Content-Type: image/jpg
Link: <http://this-is-a-weather-forecast>; rel="profile"
Family photo:
Content-Type: image/jpg
Link: <http://this-is-a-family-photo>; rel="profile"
For further hyper-linking we could even add a link to the family-homepage:
Content-Type: image/jpg
Link: <http://this-is-a-family-photo>; rel="profile",
<http://peterson.com>; rel="homepage"
We could also decide to give PDF and XML representations of the weather
forecast:
Content-Type: image/jpg
Link: <http://this-is-a-weather-forecast>; rel="profile",
http://forecasts.com/1234; rel="alternate"; type="application/pdf",
http://forecasts.com/1234; rel="alternate";
type="application/vnd.weather+xml"
Following the "alternate" links we could get the PDF/XML representations
(notice the profile which is still "a weather forecast"):
Content-Type: application/pdf
Link: <http://this-is-a-weather-forecast>; rel="profile",
Content-Type: application/xml
Link: <http://this-is-a-weather-forecast>; rel="profile",
Well, that's my current take on how to distinguish between "processing
model" and "domain/vocabulary". Does it make sense to you? Its starting to
make sense to me :-)
/J�rn
This approach makes a "profile" relation, "vocabulary" or "domain"
specification redundant in the returned representation (lets stick to the
word "vocabulary"). Why? Beacuse, by selecting, for instance, the
"this-is-a-weather-forecast" link the client already knows that the returned
representation must by a weather forecast. It is then up to the client to
parse the XML/PDF/CSV/JPG/whatever and interpret it as a weather forecast.
From my POV I see to problems with this approach:
1) What about root URLs or mailed URLs or other links that do not carry any
link-relation information? I guess this is not such a big problem since
clients/agents usually know why they followed that unspecified link - for
instance because they start out with a specific task and expects a certain
returned resource.
2) Coupling between origin server and target server: who says the link
points to a server under the control of the same authority as the one that
owns the link? What if the target server decided to change the resource
without informing the origin server? Perhaps the target server has no
knowledge of the origin server. What happens is that the origin server
instructs the client to make some assumption about the target servers data -
an assumption that might be wrong.
But, as one might argue, we cannot change the fact that the client has some
kind of expectation about the returned resource. It did follow that weather
forecast for a reason, right? What if the server returns a representation of
a cat instead? It still fails, right?
Yes, it still fails. But without some vocabulary visible in the returned
representation it fails in mysterious ways - it gets dates where integers
are expected and structs where simple values are expected, and it has
absolutely no way to know why. If instead the vocabulary was visible, it
could tell the end user "Hey, this is a cat! I expected a weather forecast,
there is no way for me to handle that!". That makes a difference to me.
From my POV there is nothing lost by returning a vocabulary specification.
On the other hand I see some problems when you stick to link-rels only.
For these reasons I prefer to make the vocabulary visible in the returned
representation.
/J�rn
----- Original Message -----
From: "J�rn Wildt" <j...@fjeldgruppen.dk>
To: <hyperme...@googlegroups.com>
Sent: Thursday, March 22, 2012 8:33 PM
Subject: Re: Media Type Design - Should the media subtype describe the
resource?
Link: <some-url>; rel="profile"
Weather forecast:
Family photo:
/J�rn
--
Seems like I am talking to myself here, but I just remembered one more thing which is part of a media-type specification: the available set of relation types.
Could you please explain what this has to do with RDF and why it makes you
so emotional? The approach I've described is more about "strict" typing vs.
duck typing - and just as a side note, RDF doesn't require that at all.
> If it's a hypertext application, this sort of typing should be
> unnecessary as it is redundant.. resource's shouldn't have to try and
> 'bite their own teeth' like this, it undermines any requirement from
> clients to 'discover' resources by traversing through the application
> and will only stand to induce a bunch of less evolvable clients to
> your application as a result.
What about self-descriptive messages? How would you find out the type of a
resource if someone copies a link and sends it to someone else via Skype,
e.g.? I don't really believe link relations should be used that way. If what
you are saying is true, you wouldn't even need MIME types, right?
--
Markus Lanthaler
@markuslanthaler
It's not required, but it is the standard way RDF is used - no?
The reason I dislike RDF so much is because it takes a model that is
potentially very simple and elegant but drags it down into something
long-winded, esoteric, impractical and just generally confused. That
wouldn't be so bad if it didn't then begin inflicting its insanity on
the whole web by inducing ridiculous solutions to
would-be-non-problems such as range-14. It's a very frustrating
spectacle.
>> If it's a hypertext application, this sort of typing should be
>> unnecessary as it is redundant.. resource's shouldn't have to try and
>> 'bite their own teeth' like this, it undermines any requirement from
>> clients to 'discover' resources by traversing through the application
>> and will only stand to induce a bunch of less evolvable clients to
>> your application as a result.
>
> What about self-descriptive messages?
This has nothing to do with self-descriptive messages.
Visibility/self-descriptiveness is a virtue of protocol messages (i.e.
HTTP requests and responses), and is about the degree of
process-ability on them possible by intermediaries.
"Within REST, intermediary components can actively transform the
content of messages because the messages are self-descriptive and
their semantics are visible to intermediaries."
> How would you find out the type of a
> resource if someone copies a link and sends it to someone else via Skype,
> e.g.?
In the human world of HTML this is down t the conversation you were
having which lead to the sending of the link, and also down to the
ability of the page to infer its "type"/meaning through inferences of
symbolism, imagery, and natural language (e.g. organisation logos,
page titles, etc.). In the human web any URL is an entry point because
human's are adept at 'jumping in' and establishing their bearings.
Machines are not capable of this, you wouldn't just chuck links to
arbitrary resources at a piece of code and expect it to figure out
what to do - this just is not a realistic design objective. In a m2m
scenario, a link you provide cold and 'with no context' is called an
*entry point*, this is exactly what makes an entry point distinct from
non-entry points. Hence this quote from Roy:
"A REST API should be entered with no prior knowledge beyond the
initial URI (bookmark) and set of standardized media types that are
appropriate for the intended audience (i.e., expected to be understood
by any client that might use the API). From that point on, all
application state transitions must be driven by client selection of
server-provided choices that are present in the received
representations or implied by the user’s manipulation of those
representations."
> I don't really believe link relations should be used that way. If what
> you are saying is true, you wouldn't even need MIME types, right?
Of course you would, you still need media types to establish a
standard for how to process a given representation i.e. a 'uniform
interface' - this is what HTML does for GUI hypertext applications,
and it's what HAL does for machine apps.
Cheers,
Mike
That's exactly the point. By relying purely on link relations, the semantics
are not visible at all. How would an intermediary be able to understand that
conversation? It has no clue which link-relation was used to retrieve a
resource and would thus not understand the entity if it wouldn't have other
means of finding out what the representation is about - either by duck
typing or "strong" typing.
If you argue that it would know the link relation because it saw the
previous message from the server, then you are basically saying that the
intermediary needs to keep record of all exchanged messages to reconstruct
the state of the client and the server to interpret a specific message.
--
Markus Lanthaler
@markuslanthaler
e.g. specifying a requirement on clients to specify what kind of mood
the developer is in or what their favourite colour is would make the
messages "more self-descriptive".. but in a completely pointless way.
Let's take ESI (edge side includes) as an example. There you have a set of
well-known tags which can be included in textual files (doesn't matter
whether it is txt, xml, or html). The edge side cache simple scans
representations for ESI-tags and if they are present, it replaces them.
--
Markus Lanthaler
@markuslanthaler
------
From: hyperme...@googlegroups.com
[mailto:hyperme...@googlegroups.com] On Behalf Of Jørn Wildt
Sent: Friday, March 23, 2012 8:37 PM
To: hyperme...@googlegroups.com
Subject: Re: Media Type Design - Should the media subtype describe the
resource?
I think the problem here is that you guys have different interpretations of
/Jørn
--
You received this message because you are subscribed to the Google Groups
"Hypermedia Web" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hypermedia-web/-/5NM95S7Emf4J.
Well, you are partly right. But I think it depends on what the intermediary
is supposed to do and what media type is used.Let's take ESI (edge side includes) as an example. There you have a set of
well-known tags which can be included in textual files (doesn't matter
whether it is txt, xml, or html). The edge side cache simple scans
representations for ESI-tags and if they are present, it replaces them.
--
Markus Lanthaler
@markuslanthaler
------
From: hypermedia-web@googlegroups.com
[mailto:hypermedia-web@googlegroups.com] On Behalf Of Jørn Wildt
Sent: Friday, March 23, 2012 8:37 PM
Subject: Re: Media Type Design - Should the media subtype describe the
resource?
I think the problem here is that you guys have different interpretations of
"self-descriptive and semantics visible to intermediaries." (sorry if I am
wrong):- The shared understanding is about the processing model of the content -
the "HOW do I read and interact with this data".- The shared understanding is NOT about "WHAT data is this" (the vocabulary
or domain specific semantics) - the intermediaries do not need a shared
understanding of whether a photo is a family photo or a weather forecast -
they just have to know that, yes, it is a photo (image/jpg).So image/jpg is self-descriptive enough for the intermediaries to do, for
instance, re-sizing of the image data, like Opera Mini's servers does. But
image/jpg is not enough for the client which must be able to distinguish
between weather forecasts and family photos. Luckily the client is able to
remember where it came from - it actually has the goal of fetching a weather
forecast and thus it followed the link-relation "weather".Hopefully that clarifies it slightly :-)
/Jørn
--
You received this message because you are subscribed to the Google Groups
"Hypermedia Web" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hypermedia-web/-/5NM95S7Emf4J.
To post to this group, send email to hypermedia-web@googlegroups.com.
To unsubscribe from this group, send email to
On Fri, Mar 23, 2012 at 1:26 PM, Jørn Wildt <j...@fjeldgruppen.dk> wrote:
> Markus, I am not sure I get your point about ESI? It illustrates quite well
> that a media-type like text/html is enough for intermediaries to work with -
> they need not to know what link-relation the client was following. From an
> ESI POV it doesn't matter whether the HTML represents a cat or a sales
> order.
>
> /Jørn
>
> Den fredag den 23. marts 2012 14.11.48 UTC+1 skrev Markus Lanthaler:
>>
>> Well, you are partly right. But I think it depends on what the
>> intermediary
>> is supposed to do and what media type is used.
>>
>> Let's take ESI (edge side includes) as an example. There you have a set of
>> well-known tags which can be included in textual files (doesn't matter
>> whether it is txt, xml, or html). The edge side cache simple scans
>> representations for ESI-tags and if they are present, it replaces them.
>>
>>
>> --
>> Markus Lanthaler
>> @markuslanthaler
>>
>> ------
>> From: hyperme...@googlegroups.com
>> [mailto:hyperme...@googlegroups.com] On Behalf Of Jørn Wildt
>>
>>
>> Sent: Friday, March 23, 2012 8:37 PM
>> To: hyperme...@googlegroups.com
>> To post to this group, send email to hyperme...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> hypermedia-we...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/hypermedia-web?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hypermedia Web" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hypermedia-web/-/VAc_vd8x_uAJ.
>
> To post to this group, send email to hyperme...@googlegroups.com.
> To unsubscribe from this group, send email to
> hypermedia-we...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Hypermedia Web" group.
Agree
> 2) Vocabulary/domain-semantics can be indicated through the
> media-type or another part of the response. I think media-type
> is the most widely accepted way of doing it - but I am in favor
> of keeping the set of standard media-types small-ish and instead
> use another part of the response to indicate vocabulary/domain.
Agree
> 3) New media-types should cover some concept broader than a simple
> entity. Think "payment gateway vs. sales order" or "Contact book
> vs. person".
Agree. My POV is that a new media-type should be created if any
(combination) of the following points is true:
- a new serialization syntax is introduced
- the semantics can't be communicated with an existing media type
- the result of creating a solution on top of an existing generic media
type would result in a solution that appears to be more complex than
necessary (this sometimes might mean that just a subset of an existing media
type is used)
--
Markus Lanthaler
@markuslanthaler
What I tried to say here is that at some point the client/intermediary has to understand the semantics of the representation – at least partly. Inferring that knowledge from the context might work sometimes but is, IMHO, most of the time not enough.
--
Markus Lanthaler
@markuslanthaler
To view this discussion on the web visit https://groups.google.com/d/msg/hypermedia-web/-/VAc_vd8x_uAJ.
To post to this group, send email to hyperme...@googlegroups.com.
To unsubscribe from this group, send email to hypermedia-we...@googlegroups.com.
On Fri, Mar 23, 2012 at 4:52 PM, Jørn Wildt <j...@fjeldgruppen.dk> wrote:
>
> So for now my POV is:
>
> 1) I (still) don't think rel-types carries enough trustworthy information to
> stand alone. The "payment" rel-type and Ians comments illustrates why. The
> returned representation must somehow indicate the
> vocabulary/domain-semantics used.
>
Just so I understand the strength of that statement. Are you saying
that you don't think using rel-types to convey lots of semantic
information works, or are you saying that you wouldn't choose to do it
that way.
I'm curious, because I am using links to convey lots of semantic
information along with a relatively generic HAL-like media type and
it's working just fine for me.
Darrel
> 2) Vocabulary/domain-semantics can be indicated through the media-type or
> another part of the response. I think media-type is the most widely accepted
> way of doing it - but I am in favor of keeping the set of standard
> media-types small-ish and instead use another part of the response to
> indicate vocabulary/domain.
>
> 3) New media-types should cover some concept broader than a simple entity.
> Think "payment gateway vs. sales order" or "Contact book vs. person".
>
> /Jørn
>
>
> Sent: Friday, March 23, 2012 8:37 PM
> To: hyperme...@googlegroups.com
> Subject: Re: Media Type Design - Should the media subtype describe the
> resource?
>
> I think the problem here is that you guys have different interpretations of
> "self-descriptive and semantics visible to intermediaries." (sorry if I am
> wrong):
>
> - The shared understanding is about the processing model of the content -
> the "HOW do I read and interact with this data".
>
> - The shared understanding is NOT about "WHAT data is this" (the vocabulary
> or domain specific semantics) - the intermediaries do not need a shared
> understanding of whether a photo is a family photo or a weather forecast -
> they just have to know that, yes, it is a photo (image/jpg).
>
> So image/jpg is self-descriptive enough for the intermediaries to do, for
> instance, re-sizing of the image data, like Opera Mini's servers does. But
> image/jpg is not enough for the client which must be able to distinguish
> between weather forecasts and family photos. Luckily the client is able to
> remember where it came from - it actually has the goal of fetching a weather
> forecast and thus it followed the link-relation "weather".
>
> Hopefully that clarifies it slightly :-)
>
> /Jørn
> --
> You received this message because you are subscribed to the Google Groups
> "Hypermedia Web" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hypermedia-web/-/5NM95S7Emf4J.
> To post to this group, send email to hyperme...@googlegroups.com.
> To unsubscribe from this group, send email to
> hypermedia-we...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hypermedia-web?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hypermedia Web" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hypermedia-web/-/VAc_vd8x_uAJ.
> To post to this group, send email to hyperme...@googlegroups.com.
> To unsubscribe from this group, send email to
> hypermedia-we...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hypermedia-web?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hypermedia Web" group.
Depends how you define domain agnostic, but yeah, basically yes. You can
also see them as sub-resources within a representation and there they are
typed. That's why I used them as an example - admittedly not the best one
though.
--
Markus Lanthaler
@markuslanthaler
I have no doubt that it works in *lots* of places. What I am saying is that
there exists situations where it is not enough to use link-rels only. Ian
gave an example of a "payment" relation which won't tell your client how to
interact with the target server (see my previous post) - it says nothing
more than "There's a payment gateway there - go figure how to use it".
So what's the difference between the situations where link-rels are enough -
and those situations where it is not?
It seems like we have to distinguish between "internal" and "external" links
(in lack of better words). Internal links are characterized by linking
between two servers under control of the same authority, and they can convey
lots of semantic information (links that I would call "action links").
External links are the opposite - they link servers that may not be under
control of the same authority, or they convey more broad/vague semantics.
Examples of internal links:
- "parent"
- "edit"
- "owner"
Examples of external links:
- "payment-gateway"
- "shopping-list"
- "ticket-reservation-system"
Let me repeat what Ian said:
> When you see a piece of hypermedia, a link for example, in a document,
> there are several questions you might quite reasonably want answered:
> 1. What does the link (and the linked resource) mean in the context of the
> representation in which the link is found? In the words of the Web Linking
> RFC, how is the current context related to another resource?
> 2. How can one access the linked resource? Which HTTP method should be
> used? Which headers should be supplied?
> 3. What media type can we expect for the response?
> 4. What media type should we use for the request (if submitting data)?
Internal links can answer all 1-4 questions since both origin and target
server are under control of the same authority. External links cannot
trustworthly answer question 2-4 since the origin server has no control of
the target server.
My guess is that most links presented in current hyper-media based systems
are of the internal kind and thus the generic HAL approach with complex link
semantics works just fine for most people.
My guess is also that the clients are programmed like this:
1) Get link-rel "owner"
2) Follow link and GET owner in some generic format (plain XML, HAL, HTML
or other).
3) Assume the domain semantics of the XML/HAL/HTML/whatever is X and
decode the data accordingly.
The assumption in step 3 is based on the link-rel. This works fine with
internal links.
But what if the link-rel was more generic - like "payment-gateway"? Then the
client cannot rely only on link-rel semantics and generic media-types like
HAL - it would simply not know what to do with the returned HAL resource
since it could be either a VISA gateway, a PayPal gateway or some other
gateway.
So to answer your question "Are you saying that you don't think using
rel-types to convey lots of semantic
information works, or are you saying that you wouldn't choose to do it that
way":
- I am saying that it "depends". It works fine in many, if not most, cases.
I would certainly do it for internal "action" links like "edit this" or
"post purchase order here".
- I am also saying that I would prefer the resource to be self-descriptive
both in terms of "processing model" (this is XML/CSV/PDF etc.) AND domain
(this is a Person/Dog/Salesorder).
- I am still in doubt about how to convey domain specific information (but I
won't repeat that story here).
Regards, J�rn
1. In the beginning there should be a goal to pursue, and an initial
context (page?) where to start from. The client would need information
about that context and it will possibly get there looking to achieve its
goal.
2. The client will then need to use three types of information: the
actual business data, control data and status data. The data components
it will use may have all that data mixed in a complex structure. My POV
indicates a Media Type will tell me the business type of data, it will
also tell me about the structure of the data, and it may contain control
and status data. I need to know how to consume every part, and of course
a document has lots of information.
3. So, here I am in an initial context looking to pay for some goodies.
I know the initial context is a general portal, so I start looking for
links (control) to go to my next state. Based on the media I'm using, I
can get lots of information from several parts. Say, we are using an XML
based media type. If so, I have (per infoset) elements and attributes.
The element name may help me find my link (say a <payments> element,
just like <img> tells me I'm dealing with an image) or if it is a
generic element, some of its attributes (the name, the type or the rel).
4. And at this point, my advice is to use the rel attribute for what it
was created for: identify the relation the resource identified by the
URL has with the current context (document). That means I should not use
the rel to indicate any action (rel="edit"), and (as I discussed some
time ago with Mike Amundsen) it may be also good not to use it as a type
identifier (rel="person"). If I hit a <payments rel="gateway"> I may say
this is a link to a resource that is a payments gateway from the current
context,where gateway is not a type but a relation. Or I may use a
better word.
5. So, no action? How do I know how to talk to this thing? Well, I
guess the actual control information is telling me that. The link is a
structure that invites to follow, and that means changing state/context.
So I should do a GET and change my context and then go on from there. In
fact, any other operation over a link may get confusing, maybe a HEAD,
but POST, PUT, they need more information (like what to POST, for
instance). For those I would use other structures, like forms.
6. That has a little issue with J�rn's idea of the "internal" link, as
this concept implies out-of-band knowledge that may speed up processing
between two server under the same authority, but it will also make them
a little more difficult to maintain (as the changes should be done in
all related servers). So, IMHO, the idea of a rel answering all 4
questions is not a good one after all. It may answer question 1, and
that is as far as I would go. I need to answer 2 with a simple GET, for
other operations use other structures. For question 3, that is conneg.
For 4, same that is another structure, like forms (Ian has nice work
about this).
7. If we need more information about working with a gateway, the GET may
bring an HTML document. It is a document, meaning it has information,
business data I can process, information about the state, control
information and links. The client may be able to learn from it how to
work with it. Think about it, if I understand HTML I should know how to
deal with Forms, so I may be able to do some operations. No need to
reinvent the wheel and say a one word rel attribute will contain all
that info. IMHO. Get to the extreme: the get to that payment link brings
a... WSDL! Oh my! No panic, I read that XML description and found out
what the endpoints are, how to create XML (as the schema is embedded)
based messages and how to send that info. All that I need. It will even
tell me what operation to use. What data do I put in the XML? Well, I
assume each field has a business related name, so in credit card I put
my credit card number, that is business semantics! Just like filling out
a form. See? Same can happen with other media types. No need to put
descriptions and information in structures that are not designed for them.
What do you think?
William Martinez Pomares.
Seems like we are very much in line here: the more semantics you put into a
link-rel, the more you couple the two related resources.
Regarding "internal action links" like "edit" or "post-that-data-here": yes,
that adds "out-of-band knowledge that may speed up processing". The use of
forms (with human readable documentation like HTML) would in principle be
better, create looser coupling and put the documentation inline where it is
needed ... but it would also put a slightly bigger burden on the client as
it will have to know how to parse forms and react to the form's
specification (versus simply hardcoding it).
> and (as I discussed some time ago with Mike Amundsen) it may be also good
> not to use it as a type identifier (rel="person")
Do you have a public pointer to that discussion? Thanks.
But lets go back to the original discussion about media-types. If we should
not put type information in link-rels (which I agree on) where would you
then put the type information, or, how should your client discover the type
info?
How about an example ... lets take the concept of a contact book with
persons and contact groups: given that I followed the link-rel "contact" and
that contact may point to different types of entities - for instance either
a 1) Person, 2) A group of persons, or 3) An organization or company.
- Would you create a new media-type for this? Would you create more than
one? How would you name it?
- Where would you put the type information? How should the client discover
it?
Other people are of course most welcome to chime in with their suggestions
:-)
/J�rn
----- Original Message -----
From: "William Martinez Pomares" <wmar...@acoscomp.com>
To: <hyperme...@googlegroups.com>
Sent: Monday, March 26, 2012 3:26 AM
Subject: Re: Media Type Design - Should the media subtype describe the
resource?
What do you think?
William Martinez Pomares.
--
The more semantics you share between client and server the more
coupling you create. In my opinion, it doesn't matter if you use link
relations or media types to communicate the semantics the effect is
very similar.
I see this debate as similar to the "should we use attributes or
elements in our XML". There are pros and cons to both and depending
on the context, one may make more sense than the other. But debating
"what is the right way" is a rat hole.
Regarding the "link relation is supposed to describe the relation
between two resources". This is such a nebulous debate because of the
imprecision of the English language. Is the link relation "Customer"
a thing or a relation? In English it could be used to describe both.
Even the infamous rel="edit", although poorly named, in reality what
it points to is an "Edit Form". Therefore the form to edit the
resource and the resource itself are related by an "edit' link.
Personally, I don't see the distinction between internal and external
link relations. RFC5988 distinguishes between public and extended
link relation types based on their applicability and expected usage
but as far as how they convey semantic information they, I don't see a
difference.
When someone mints a new link rel, they need to decide how precisely
that link relation is going to define the interaction mechanism.
rel="payment" is extremely vague about how it is going to happen.
rel="search" is much more precise. There is not a right or wrong way,
there are just different ways.
Darrel
> /Jørn
> 6. That has a little issue with Jørn's idea of the "internal" link, as
>> Regards, Jørn
Sorry if I end up shooting myself in the foot and showing off my ignorance,
but in my opinion it does matter: a link relation that specifies semantics
about the target resource makes a promisse about that resource - and that's
a promiss it has no way to guarantee, only the target server knows the
complete semantics of the target resource.
If, on the other hand, you move semantics out of the link-relation and into
the media-type (or similar mechanism) of the target resource then the target
resource can be self-descriptive and make promisses about its own
semantics - promisses it actually has the authoriy to make and keep.
As I see it we reduce coupling between the two resources by moving semantics
out of link-rels and into media-types (or similar). This makes maintance
easier since we can change semantics of the target resource without having
to change the link-rel of the origin resource.
Please note that I am not talking about coupling between client and server -
the problem here is about coupling between two resources.
> There is not a right or wrong way,
> there are just different ways.
There are also ways of more coupling - and ways of less coupling. If someone
asks me "should I use a link-rel or a media-type for X" then I want to be
able to give them the best possible answer. To do so I myself must have the
best possible understanding of the pros and cons of both ... something which
I am still working on. Thus my interest in this debate.
/J�rn
----- Original Message -----
From: "Darrel Miller" <darrel...@gmail.com>
To: <hyperme...@googlegroups.com>
Sent: Monday, March 26, 2012 2:47 PM
Subject: Re: Media Type Design - Should the media subtype describe the
resource?
J�rn, William,
Darrel
> /J�rn
> 6. That has a little issue with J�rn's idea of the "internal" link, as
>> Regards, J�rn
I agree that using a link with very strong semantics to resource that
is not under your control is probably not a great idea. However, even
with a weak link, the third party server could change to only
supporting a media that you don't understand. e.g.
application/vnd.foo.bar.v2
This might be what you were meaning by internal and external links,
and I was just too slow to pick up on it. If the server controls both
ends of the link then updating the semantics is easy to handle but if
the link points to a third party then the rules are slightly
different.
Either way the third party has defined a contract that says you need
to understand how to activate a link to get to my resource and you
need to understand the semantics of what I return. Which spec that
information is in, the link rel spec or the media type spec is not a
huge difference.
Arguably if a client understands multiple different media type
semantics e.g. V1, V2 and V3 then the server can change the response
at will and the client can deal with any of the responses however, the
client needs to know about V1,V2 and V3 in advance anyway.
What I'm trying to say is if your server changes the semantics of the
resource via a media type, the client still needs to be updated to
understand those semantics, so how is that an advantage over changing
the link rel semantics?
Darrel
> /Jørn
>
> ----- Original Message ----- From: "Darrel Miller" <darrel...@gmail.com>
> To: <hyperme...@googlegroups.com>
> Sent: Monday, March 26, 2012 2:47 PM
>
> Subject: Re: Media Type Design - Should the media subtype describe the
> resource?
>
>
> Jørn, William,
>> /Jørn
>> 6. That has a little issue with Jørn's idea of the "internal" link, as
>>> Regards, Jørn
1. I agree, no right or wrong, but I do believe that if you have one
meaning for something and use it like it was supposed to be used, it
will be better for all of us as there is less chance to run over a
semantic dissonance. That is why I preach for not overloading meaning in
things, particularly in rel attribute where everybody want to put new
meanings everyday. See my point?
2. The relation definition is what we should discuss. Actually, to me is
as simple as "take the current context into consideration". The rel is
just half of the info. Many proposals I see want the rel to be the heart
and everything else is of no use. That overloading is far from good.
Fair use of the idea is what is called for here.
3. The rel="edit". That is just a fine example. It depends on how you
understand the rel. Is it an action? Am I supposed to POST/PUT to it
with modifications? Am I supposed to GET it and see if it has a form?
And what is that are you editing? To understand all that, you need first
to know where are you at. A Blog Post? Then a link to a resource with
rel="edit" is just fine to say to me that resource will help me edit the
current post, because it is an edit relation. And all links are made to
be followed, which means a GET. Those two simple rules just simplified
my life. But if I say rel="edit" means an action that is meant to use
POST against that URL to edit the current resource (or even worse,
another unrelated resource) then we are overloading the rel attribute.
So, my call is to simplify interactions, not overloading semantics.
Following these two rules (using relations and following links) we
minimize the problems of servers changing things.
Cheers.
William Martinez.
On 3/26/2012 6:47 AM, Darrel Miller wrote:
> J锟絩n, William,
>> /J锟絩n
>> 6. That has a little issue with J锟絩n's idea of the "internal" link, as
>>> Regards, J锟絩n
Presumably, minting a new relation that extends the semantics of an
existing relation in various ways is ok?
William.
Media type has business, control and status assets too. The document of
certain media type will contain some business data, some control data
and some status data, how much and where is actually a thing we know
from the media type itself.
So, at the end of the day we should say "it depends". And we can use all
the assets we have, if we always use the things for what they were made
for. If not, there is no point in keeping specs.
Cheers.
William
> /J�rn
I will confess that I am _automatically_ wary when I see someone
saying things like a single thing has multiple aspects ("Media type
has business, control and status assets").
I admit this is an automatic reaction; not one based on reason<g>.
Can you elaborate on this (or point to some other docs that elaborate
on it)? IOW, can you show me how I can look at a media type design and
identify the "business", "control", and "stauts" assets?
mca
http://amundsen.com/blog/
http://twitter.com@mamund
http://mamund.com/foaf.rdf#me
On Mon, Mar 26, 2012 at 10:26, William Martinez Pomares
<wmar...@acoscomp.com> wrote:
> I follow this ideas.
> Actually, semantics can be of three types: business, control and status.
> In rel, there is an implicit semantic of relation, nothing more. Then actual
> additional semantic of "edit" is given by the shared understanding of the
> word and the control process that we should agree upon. We can say that
> shared knowledge is actually coupling. Well, yes, but it is a coupling we
> need. I can't do anything entering a bank if I do not know at least what
> money is. And if I do not know, I may need to learn first, which will create
> coupling. No way to escape from it. Bad coupling is when, to draw money out
> of the ATM, you need to know assembler code to post your request, meaning
> you need to know what device is the ATM running on top of. Agh!.
>
> Media type has business, control and status assets too. The document of
> certain media type will contain some business data, some control data and
> some status data, how much and where is actually a thing we know from the
> media type itself.
>
> So, at the end of the day we should say "it depends". And we can use all the
> assets we have, if we always use the things for what they were made for. If
> not, there is no point in keeping specs.
>
> Cheers.
>
> William
>
>> /Jørn
An atom feed (ATOM+XML). It is an XML document that starts with <feed>.
It has other tags, like title (both feed level and entry level) ,
summary, etc.
Many of those elements are business related. Thus you actually have
business data like the title and the summary. You also have links, which
will give you ways of accessing other information not in the current
document. Some links will have rel that will tell you about the relation
of that other resources and the current one. That to me is control
information I can use to move around and get to the next state (like
getting the entry contents and displaying them). Status? not sure, some
elements may be used for that, like updated or published, if you use the
feed to track the result of an operation. But mostly, the ATOM is a
business oriented media type.
To use the business elements, you need to have a glossary or embedded
knowldge of what a title is, for instance. To use a link there is not
need for business knowledge, but control knowledge.
Now, WSDL (WSDL+XML). This is a media type full of control elements:
operations, message descriptions, endpoints. It has some business info,
like the actual type definition. In order to use it, you need to know
how all those controls work, but you will also need to know some
business to fill out the fields in the messages.
That is what I meant. Not sure if that is what everybody understood. I
prefer to have the management of those three different elements
separated. That way I can have one component dealing with the link
following or the message sending and encodiing, and another one busy
getting the data I need into the fields, or reading that data and
translating it into my own system. Separation of concerns.
Hope this helps...
William.
> What I'm trying to say is if your server changes the semantics of the
> resource via a media type, the client still needs to be updated to
> understand those semantics, so how is that an advantage over changing
> the link rel semantics?
Yes, there is no doubt about the fact that the client must be updated in
order to work with the new semantics.
So what's the advantage? As I said before - it reduces coupling between
resources and thus makes it easier to maintain the system from a server side
point of view.
From the client's POV there aint so much difference - it can either look for
link relation "x-v1" or "x-v2" in the origin resource versus recognize
media-type "app/x-v1" or "app/x-v2" in the target resource's response - all
depending on the client's capabilities.
But using link-rels with lots of semantics reduces the self-descriptiveness
of the target resource.
Consider the following example: you are asked to write a client that takes a
set of URLs and then crawls those for the best possible price of some item.
All you know is that each URL refers to a webshop with a public API. Each of
the APIs are coded with generic hyper-media-types like HAL og HTML.
- How would your client know what to do with the responses?
- If instead each of the APIs returned a more specific media-type (or used
other means for specifying semantics) then the client would know exactly
what to do when interpreting the response - assuming of course that it
understands all media-types it finds.
I am still not saying that link-rels are not useful. They are. But I think
its a dangerous path to take when we put too much semantics in a link-rel -
instead of letting the target server specifiy its own semantics.
/J�rn
> What I'm trying to say is if your server changes the semantics of the
> resource via a media type, the client still needs to be updated to
> understand those semantics, so how is that an advantage over changing
> the link rel semantics?
I tried to answer that in my previous post. Now I would like to place the
opposite question: if it does not matter whether I use link-rels or
media-types (or a similar mechanism) - then why should I not put the
semantic in the response of the target resource (and thus make it more
self-descriptive) but rather put the semantic specs in the link-rel?
Thanks, J�rn
off the top of my head:
a media type that covers a domain is not granular, so a breaking
change anywhere in the application flow it covers is going to require
you bump the media type identifier across the board. If you use link
relations for this purpose you have very fine grain control over how
and where changes can be introduced. You also get easier, finer
grained ability to re-use controls, and sets of controls, between
applications. Also, with relations as your control you can simply
defer to Link headers when non-hypertext media types (e.g. plain text
or images) need to be involved in your application flow.
Nothing. Two application paths would 'cross paths' over a resource,
that's ok. We're just directing clients through applications, not
trying to concoct a semantic web ;)
> So, is there a better way that combines the benefits of both approaches?
>
> I suggest something slightly different: let the target resource specify its
> own semantics using a "profile" link relation (see
> http://www.ietf.org/id/draft-wilde-profile-link-00.txt) in its HTTP "Link"
> header (see http://tools.ietf.org/html/rfc5988).
>
> Example: let one resource link to a payment gateway using the broad link
> relation "payment". When issuing a GET (or HEAD) on the target resource (the
> payment gateway) it can get a generic media-type like HAL, HTML or even XML
> with a Link header included:
>
> Link: <http://this-is-a-visa-payment-gateway>; rel=profile
> Content-Type: application/hal+xml
>
> In this way we both get the fine grained control of semantics from using
> link-rels while at the same time we put the semantic specification where it
> belongs; on the target resource.
>
> What problems do you see with this solution?
I really am not a fan of this approach at all; if the application is
meant to be driven by hypertext then a profile is not only redundant,
it actually stands to undermine the hypermedia that is meant to be
driving your application. Clients should be starting at an entry
point, and from then on they should be traversing through your
resources via hypertext - this means that clients _should_ be deriving
the meaning of a given resource from the context which led to its
discovery. Any other approach - whether it's typing through a media
type identifier or a profile - undermines the effort to induce this
behaviour because it implies that the resource can 'stand on its own'.
Resources that are not entry point _cannot_ stand on their own in a
fully hypertext application, that is _the property_ that distinguishes
them from entry points.
Cheers,
Mike
https://gist.github.com/f2c622795614a800fbf6
note: I do not recommend this approach at all, I just brought this up
to show you could do this without the Link header.
afaik that was actually before the draft appeared, hopefully that
doesn't mean I am responsible for it in any way! :)
1) A non-entry-point resource needs no profile/type/domain information in
its response since that would be given by the previous link-rel that lead to
it?
2) If, for some reason, we start exposing some non-entry-point resource as
an entry-point then you would consider adding some sort of
profile/type/domain information to its response?
3) By following a link-rel the client gets enough information to extract
domain specific information from the target resource (like "this is a
person/salesorder/other") - without inspecting the payload or looking at
anything else than the Content-Type header (thus enabling the use of generic
media-types like HAL)?
/J�rn
----- Original Message -----
From: "Mike Kelly" <mi...@mykanjo.co.uk>
To: <hyperme...@googlegroups.com>
Sent: Tuesday, March 27, 2012 2:03 PM
Subject: Re: Media Type Design - Should the media subtype describe the
resource?
fwiw someone brought this up on hal-discuss and I proposed they do it
this way within HAL:
https://gist.github.com/f2c622795614a800fbf6
note: I do not recommend this approach at all, I just brought this up
to show you could do this without the Link header.
afaik that was actually before the draft appeared, hopefully that
doesn't mean I am responsible for it in any way! :)
On Tue, Mar 27, 2012 at 12:54 PM, Mike Kelly <mi...@mykanjo.co.uk> wrote:
--
Yep
> 2) If, for some reason, we start exposing some non-entry-point resource as
> an entry-point then you would consider adding some sort of
> profile/type/domain information to its response?
No it shouldn't be necessary. An entry point is a resource that a
client has prior knowledge of, i.e. it's approached logically as an
assumed link that's built into the client logic itself. Code that
looks like:
// get to the entry point resource
entryPointUrl = "http://example.com/"
entryPoint = http.get(entryPointUrl)
// now start following rels to non-entry-point resources
userCollection = http.get(entryPoint._links.users.href)
firstUser = userCollection._embedded.user[0]
> 3) By following a link-rel the client gets enough information to extract
> domain specific information from the target resource (like "this is a
> person/salesorder/other") - without inspecting the payload or looking at
> anything else than the Content-Type header (thus enabling the use of generic
> media-types like HAL)?
Yep, and by exposing your application exclusively via relations in
this way you are constraining the way that client developers can write
their clients against it, i.e. you are inducing them to interpret and
consume your resources by hypertext and everyone is clear where change
in the application is going to be enacted (i.e. the rels)
Cheers,
Mike
<link rel="urn:acme:responsible" href="..."/>
GET ...
=>
200 OK
<resource self="...">
<name>Fixit Corp.</name> <!-- name is a common property of all
parties -->
<resource rel="Company" href="/company/3243">
<employeeCount>233</employeeCount>
<resource>
<resource>
or
GET ...
=>
200 OK
<resource self="...">
<name>Jame Brown</name> <!-- name is a common property of all
parties -->
<resource rel="person" href="/person/3243">
<firstName>James</firstName>
<lastName>Brown</lastName>
<age>75</age>
<resource>
<resource>
Darrel
> --
Hey Ian,
On Mar 23, 2012, at 10:38 AM, Ian Robinson wrote:
> Hi Jørn
>
> Just to reassure you we're listening :)
>
> On 23 March 2012 08:59, Jørn Wildt <j...@fjeldgruppen.dk> wrote:
> Seems like I am talking to myself here, but I just remembered one more thing which is part of a media-type specification: the available set of relation types.
>
>
> While link relations can of course be defined as part of a media type, it's important to point out they can as easily be defined outside any specific media type, and are often media type agnostic.
Right. This is the principle of orthogonal specifications. If they are separate, they can evolve independently. Big win.
> 'Payment', for example, indicates that the resource at the other end of the link accepts payments; it says nothing about the expected media type.
>
Yes.
> And a comment quite separate from your points:
>
> Link relations help the client understand 'why bother following this link' - they don't necessarily have to describe how to operate the hypermedia to which they are attached, or how to manipulate the linked resource (expected media types, HTTP idioms, etc).
Right - this would be a constraint on the server that is deliberately rules out by REST. Besides, the possible interactions are all described in the HTTP spec - we need to write clients that can deal with this variety. Often this will be by one-time introspection and then setting a configuration switch. We can reasonably assume that certain big decisions are made once by a server implementor and do not frequently change.
> Overloading them with all those operational semantics is in my opinion just another attempt to disregard many of the other perfectly serviceable Web practices in favour of something that sails all too close to becoming another IDL for my liking.
You nailed it - +1
REST is all about dealing with the system-inherent inability to constrain the server. IDLs try to sell you the illusion that you can .. until you realize you can't and end up in yet another upgrade-dependency hell.
Jan
>
> Kind regards
>
> ian