[rest-practices] Relative uris

Bryan Kearney bkearney at redhat.com
Thu May 27 11:47:35 UTC 2010


On 05/27/2010 06:49 AM, Mark McLoughlin wrote:
> 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.
>

What happens if you do JSON over a message bus? Are you using the same 
serialization? That may be an edge case, but I would not want ot have to 
manage multiple serialiing layers per transprot.

-- bk




More information about the rest-practices mailing list