This morning I was fiddling around with the Atlassian BitBucket REST API so that I could display my list of Open Source projects on my website (you can find them in the sidebar) and it was driving me completely nuts. The unhelpful “Resource not found” (404) error message kept coming back even though it looked like I was entering the URI correctly for the resource endpoint.
I have to deal with RESTful servives quite a bit, and some are case-insensitive (mostly ones built on Windows) and many are case-sensitive (LAMP), but they all have the good sense (so far), when it comes to specifying a user id or user name or title of a book or movie as part of the URL to ignore any upper- and lower-case features of just that part of the URL and give you what you need. It shouldn’t matter if you enter “justinlloyd” or “JustinLloyd” for the user name, just like it shouldn’t matter if you enter “Last Tango in Paris” or “last TANGO IN paris”. It should just work!
Entering the URL https://bitbucket.org/JustinLloyd or https://bitbucket.org/justinlloyd both lead to the same page on BitBucket, but using https://api.bitbucket.org/1.0/users/justinlloyd returns a 404 Resource not found but using https://api.bitbucket.org/1.0/users/JustinLloyd works just fine and dandy.
Github, where my user name is “justinlloyd” (all lower-case) completely ignores any case you put in the user id, so I can mangle it six ways from Sunday and it still works.
I found out about Bitbucket’s persnickety URI requirements the hard-way through the use of the github-bitbucket WordPress plugin that “helpfully” uses strtolower on the username to normalize it.