refactor json api (re #325)
added client library for querying api (re #325)