Fixed handling of json errors

* Print entire json error out (before it was blank)
* Moved definition of api_base_url into directory.hpp
* Other small fixes