#121 new
Marco Antonio Gonzalez Junior

Support friendly aliases for link's rel attributes filled with namespaced URIs.

Reported by Marco Antonio Gonzalez Junior | July 12th, 2010 @ 04:16 PM

The use of an URI as the value for extension link relation types is an IETF recommendation. Restfulie should support it. The challenge is to provide a syntax sugar solution to it, keeping its usage simple on the client side.
My suggestion is to use CURIEs and QName as identifiers for extension relation types definition of the XML based formats. The root element (or some inner node) must define the namespace(s) used and the belonging rel type references it like below:

<?xml version="1.0"?>

<basket xmlns:acme="http://daffyduck.com/api/rels/" xmlns:hell="http://devil.com/api/rels" />

<link href="http://localhost:3000/baskets/1/payments" rel="payment" type="application/xml" />

<link href="http://localhost:3000/baskets/1" rel="self" type="application/xml" />

<link href="http://localhost:3000/baskets/1/make_disappear" rel="acme:freefallfromsomecanyon" />

<link href="http://localhost:3000/baskets/1/destroy" rel="hell:burn" type="application/xml" />


This way it's still possible to provide more information on the http://devil.com/api/rels/burn URI.

On the client side, we would have something like:


JSON draft proposal ("prefixes" or "@xmlns"):

"prefixes": {
    "hell": "http://www.inferno.org/api/resources/rels/",
    "heaven": "http://www.paradise.net/docs/rels/" 
"link": {
    "href": "http://kayaman.baurets.net/self/acts_as_nice_guy",
    "rel": "heaven:acts_as_nice_guy",
    "type": "application/json" 
"link": {
    "href": "http://kayaman.baurets.net/self/be_evil",
    "rel": "hell:be_evil",
    "type": "application/json" 


Client side usage example:

kayaman.links.hell.be_evil.get! \m/


As stated on section 4.2 of (1): "Note that while extension relation types are required to be URIs, a serialization of links can specify that they are expressed in another form, as long as they can be converted to URIs."


Deprecated ideas:
Server side:
link "http://mySystemOfSystems.com/rels/publish", "http://related_resource.com"

Client side:

resource.links_rel_base("http://mySystemOfSystems.com/rels").publish.post #something like that

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins