I'm trying to make a get request to an Api Rest but I'm always getting 404, nevertheless if try copying queryUrl in a browser or postMan it works perfectly.
restTemplate.getForObject(queryUrl, entity ,Integer.class);
I've also tried this:
HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.APPLICATION_JSON); HttpEntity entity = new HttpEntity(httpHeaders); log.debug("request headers: " + entity.getHeaders()); ResponseEntity response = restTemplate.exchange(queryUrl, HttpMethod.GET, entity, String.class);
But nothing changes. Can anyone help me?