All actions consume JSON.
Added end and error methods.
Requests generate error response in JSON.
Tests we get an error for request to '/api' endpoint.
JSON view and corresponding test.