Link Relations

Charles Reese <[email protected]> Tue, 5 Nov 2013 18:52:59 -0800
Newsgroups gmane.comp.web.services.rest
Message-ID <CAB44_UfxMfuJoFSvqHzAXbOX-Ctb9VwG0iJyer8DmwsmvRuNaw@mail.gmail.com>
Hi all,

I'm looking at HAL and Collection+JSON for an API I'm building. I was
wondering if there are any community norms for constructing link relations.

Here is what I'm considering:

Option 1:

/rels/playlists
/rels/playlist
/rels/playlist/insert-song
/rels/playlist/remove-song

Option 2:

/rels/playlist
/rels/playlist/create
/rels/playlist/edit
/rels/playlist/delete
/rels/playlist/insert-song
/rels/playlist/remove-song

Option 3:

list
create
edit
delete
insert-song
remove-song

The first option mixes the singular and plural for items and collections.
Then it tacks on a few actions for what doesn't fit well with CRUD. The
last option makes the state transitions explicit (but doesn't allow linking
for docs). The middle option is somewhat in between.

Which of these is preferred? Are there better options?

Charles