News for hackers. Stuff that matters.
Re:Some REST best practices by hawleyal on Monday November 17, 2014 @11:35AM (#8618916)
Agreed. Nested routing is fine, as long as it doesn't become redundant.

Do:

/artist/8/albums

/albums/9

Don't:

/artist/8/albums/9

Using query filters versus nesting are virtually synonyms. I would say there is a minor semantic distinction in that the first one is a definite relationship, and the second one is a possible relationship. That is, "get the albums for artist 8" versus "get the albums searching for artist 8". The search could include other parameters as well, making it not as definite.

/artist/8/albums

/albums?artist=8

Re:Some REST best practices by shangxiao on Monday November 17, 2014 @11:44AM (#8618984)
Chances are you're (well at least with me) going to do filtering anyway so /artist/8/albums becomes redundant ;)
Re:Some REST best practices by hawleyal on Monday November 17, 2014 @12:00PM (#8619062)
I see what you're saying, but it's not redundant, it's just a synonym. By redundant I meant that there are keys that are not necessary.

/artist/{artist}/albums

/albums?artist={artist}

AlbumsController#index(artist)