Made API compatible with Swagger-codegen

* Create an response class so that the response can be deserialized
inot an object.
* Reorganized response to make it nice to be parsed.
* Fixed several violiations againest swagger API Spec.
* Fixed a method call on NilClass error.