I’m reading RESTful Web Services Cookbook and there is a complete chapter about the identification of resources. The author emphasizes the importance of the identification process. Why is it so important?
EDIT: “REST APIs must be hypertext-driven” by Roy Fielding is quite interesting. I must confess that I don’t fully understand what Roy Fielding is actually talking about – due to my ignorance of course – but it seems to be relevant to my questions.
Fielding doesn’t have much to say on selecting identifiers.
This seems to fit the main point of “Cool URIs Don’t Change“, that while the particular pairing of identifier and resource might change, the identifier itself should always exist once created. Fielding’s other point regarding identifiers is that they should present a uniform interface. HTTP URLs achieve this in part with their hierarchical nature (at least, they’re supposed to be hierarchical). However, URIs in general don’t have to be hierarchical.
A uniform interface and hierarchical identifiers can simplify one of the primary server functions: mapping identifiers to resources. At it simplest, representations are stored in the same hierarchy as identifiers when the mapping performed is to prepend the document root to the request URI, though web services rarely use the simple mapping.
The book you’re reading suggests its own reason for devoting a chapter to picking identifiers:
With more choices comes more work. If identifiers were rigid, offering few choices, you’d have less to think about. Furthermore, since URIs are so visible and you’re going to have to live with your choices for a long time, you’d better put some thought into them.