request_impl function

Makes a request to the API and returns the response, catching HTTP errors and forwarding the HTTP body in R errors