Implement an extensible API

The API currently only accepts JSON, but could be very easily extended
to inclue XML, bencode, or other encodings. It can be accessed by
appending '?api=json' to the url of a repository.
Version 0.5.8