Add JSON API tests & cleanup

first 10 % of #2124
- added initial version of JSON API tests
- renamed error.errorCode to error.code
- renamed tags.all to tags.browse for consistency
Merge pull request #2280 from sebgie/api-cleanup