raise error if api returns bad json ( proxy might be misconfigured, so it returns 404 etc )

Signed-off-by: Farid Aliev <farid@entelo.com>