I'm designing an HTTP-based API for an intranet app. I realize it's a pretty small concern in the grand scheme of things, but: should I use hyphens, underscores, or camelCase to delimit words in the URIs?
Here are my initial thoughts:
camelCase
- possible issues if the server is case-insensitive
- seems to have fairly widespread use in query string keys (
http://api.example.com?**searchQuery**=...
), but not in other URI parts
Hyphen
- more aesthetically pleasing than the other alternatives
- seems to be widely used in the path portion of the URI
- never seen a hyphenated query string key in the wild
- possibly better for SEO (this may be a myth)
Underscore
- potentially easier for programming languages to handle
- several popular APIs (Facebook, Netflix,
StackExchange, etc.) are using underscores in all parts of the URI.
I'm leaning towards underscores for everything. The fact that most big players are using them is compelling (see https://stackoverflow.com/a/608458/360570).
hyphenated query string in the wild
. That's typically a time for camelCase. – Sandpit