RE: trailing slash for collection URIs?

"Markus Lanthaler" <[email protected]> Fri, 25 Oct 2013 16:07:42 +0200
Newsgroups gmane.comp.web.services.rest
Message-ID <[email protected]>
On Friday, October 25, 2013 8:56 AM, Thomas Koch wrote:
> this might be a hard to decide question like spaces vs. tabs: I might
> have an
> addressbook web application that has mainly two sites
> 
> /myapp/contacts (or /myapp/contacts/ ?)
> /myapp/contacts/{id}
> 
> Should the /myapp/contacts URI have a trailing slash or not?

Thomas, you will always get the same answer to questions like this: the URI
is an opaque identifier and a such it doesn't matter at all whether it
includes a trailing slash or not. But as you say...


> From an implementation perspective I like the trailing slash so that I can
> just use the contact id as a relative URI from the collection resource.

.. it may have some positive side effects choosing a specifically structured
URI. If it simplifies your implementation, go for it.


> But on
> the other site a collection might also be a resource?

A trailing slash doesn't mean that it isn't a resource anymore. It's a
resource just like everything else identified with a URI.


HTH,
Markus


--
Markus Lanthaler
@markuslanthaler