api.request: dump response json on error, along with the message from there