Subject: URI Templates in Atom links

From: James Abley <[email-masked]>
Date: Fri, 26 Feb 2010 12:20:38 +0000

Hi,

Just curious if anyone has done this or has opinions either way; e.g.

<link href="http://example.com/path/to/{deviceType}/movie/resource"
type="video/quicktime" />

Where the client applications know to substitute the parameter
appropriately.

Versus using Media RSS or similar:

<media:group>
  <media:content url="http://example.com/movie1.mov"
  fileSize="15555"
  type="video/quicktime"
  medium="video"
  isDefault="true"
  expression="full"
  bitrate="128"
  framerate="25"
  samplingrate="44.1"
  channels="2"
  duration="185"
  height="200"
  width="300"
  lang="en"/>
  <media:content url="http://example.com/movie2.mov"
  fileSize="12345"
  type="video/quicktime"
  medium="video"
  isDefault="true"
  expression="full"
  bitrate="128"
  framerate="25"
  samplingrate="44.1"
  channels="2"
  duration="185"
  height="200"
  width="300"
  lang="en" />
</media:group>

For my domain (mobile applications) the smaller payload is quite attractive,
and I control all of the clients of the feed, since I'm writing them. One
niggle is that I don't think the URI template is a valid IRI, so validation
tools might grouse.

Cheers,

James

---

From: Joe Gregorio <[email-masked]>
Date: Fri, 26 Feb 2010 10:23:55 -0500

> niggle is that I don't think the URI template is a valid IRI, so validation

Correct, URI Templates are not URIs, and there's explicit language in  the
drafts that covers that:

    URI Template expressions are not URIs: they do not identify an abstract
    or physical resource, they are not parsed as URIs, and should not be used
    in places where a URI would be expected unless the template expressions
    will be expanded by a template processor prior to use. Distinct
field, element,
    or attribute names should be used to differentiate protocol
elements that carry
    a URI Template from those that expect a URI-reference.

Using URI Templates will require either creating a custom namespaced
element for your
specific case, or creating a more general namespaced 'tlink' element
that is just like
'link', but the value of href is expected to be a URI Template.

   Thanks,
   -joe