ObjectMapper objectMapper = new ObjectMapper();
try {
apiState = objectMapper.readValue(result, APIState.class);
} catch (Exception e) {
throw new MappingException(e);
}
} else {
throw new CommunicationErrorException(HttpStatus.getStatus(response.getStatusCode()));
}
return apiState;