[rest-practices] Relative uris

Mark McLoughlin markmc at redhat.com
Thu May 27 10:49:11 UTC 2010


Hi,

For rhevm-api, we're thinking of changing all the links within our
documents to be relative to the entry point URI

So, e.g.

  HEAD /api/ HTTP/1.1
  Host: foobar

  HTTP/1.1 200 OK
  Link: <http://foobar/api/resources; rel=resources


  GET /api/resources/ HTTP/1.1
  Host: foobar

  HTTP/1.1 200 OK
  Content-Type: application/xml

  <resources>
    <resource id="12345" href="/resources/12345">
      ...
    </resource>
  </resources>

Rather than including a <base> element to describe how relative URIs
should be resolved, we're thinking of just saying that the base is
defined to be the entry point URI

We don't think this imposes a big burden on clients, but allows the
resource representations to be a good bit more compact and also means
that URIs within the documents don't need to be generated in a request
specific context

However, for link headers, we're not so keen on going with relative URIs

Any thoughts?

Thanks,
Mark.




More information about the rest-practices mailing list