added support for json api errors and creating user