*/
protected void validateResponse(Response r) {
if ( r.getStatusCode() != 200 ) {
// try parsing an API response
try {
ApiResponse ar = json.readValue(r.getResponseBody("UTF-8"), ApiResponse.class);
throw new RestServiceException(ar);
} catch (Exception e) {
ApiResponse ar = new ApiResponse(r.getStatusText());
throw new RestServiceException(ar, e);
}
}
}