Take the 2-minute tour ×

My understanding of REST (admittedly limited to pretty much the wikipedia page) is that idiom for GETing a collection is ../resource/ and an item is ../resource/itemId.

Is there a standard idiom for GETing for a sub-collection? For example, if the items in the collection have some state toggle (say states A, B, C, D), and I want to be able to ask for items with state B, is there a standard/common/best-practice way to do that?

If not, I'm currently fiddling with the following syntax options:




What pros/cons of those do you see?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You want to use the third one there, except plural (since you're getting more than one)


Because it accurately describe what you want. You're GETing a resource with a specific state.


Would indicate you're getting a specific resource uniquely identified by B


Would indicate you're getting a resource state, belonging to resource, uniquely identified by B.

An alternative if you're dealing with a finite number of states would be to make state a resource by itself and make the resource a child of that state. Then you would have


share|improve this answer
can you elaborate on the pluralization? The idiom seems to be ../resource/ for all the data, ../resource/id for a particular datum - but you're saying that the later should be ../resources/. –  Carl Jun 26 '10 at 22:09
I guess that's a matter of preference. The way that Ruby on Rails implements in, everything is always plural. /resources would be a listing of all resources, and /resources/12 would show the resource with the unique identifier 12 –  Jamie Wong Jun 26 '10 at 23:08

The REST constraints actually say nothing about how you name resources. REST just says resources should have a name.

Having said that, Jamie's answer is probably the most obvious way of doing it. You can compare naming URLs to naming procedures, there is no right and wrong way to do it, just some names are more obvious than others.

share|improve this answer

Your Answer


