I wanted to throw this question out there and get some feedback from other users of the Play Framework (specifically Play 2.0).
Lets say I have an entity called ‘FooBar’. Let’s also assume that I’m providing a Restful API that allows CRUD operations at the URL 'http://<host>/api/foo_bar'.
My question is, is there a consensus amongst the community on how to name URLs, where the URL provides access to an entity whose name contains more than one word?
I can think of the following 4 options for naming such a URL, that would each seem reasonable:
- snake case (which would be the rails convention) — http:///api/foo_bar
- camel case —
http://<host>/api/fooBar - pascal case —
http://<host>/api/FooBar - just eliminating underscores (is there a name for this?) —
http://<host>/api/foobar
Thanks in advance for the feedback!
I would avoid options 2 and 3 for two reasons:
The path component of a URI is case sensitive**, so those paths could actually point to different REST endpoints in your app and this is confusing.
Some servers (i.e. on windows) treat the path as case insensitive, which might give you problems if you need to migrate the app to a different platform (or hosting provider).
Between options 1 and 4, I prefer 1 (or hyphens), as is the de facto standard, but there’s nothing official that I know.
**The spec for the path component of a URI doesn’t specify that is case insensitive, as it does explicitly for everything that is.