Manage the case where a non-JSON format is resturned by the API

The JSON.parse error is caught and the message "Unsupported Request Method and Protocol" is now returned.

In my case I got the error "Unsupported Request Method and Protocol" placed into an HTML  page. So I fixed it that way, but it could occur because of an other kind of error.