title: 301 ResponseCode in RestTemplate Client
body: <p>I am trying to consume a service using RestTemplate in Spring. I tried around and each time getting 301 as response code. However, I am good to get a json response from the same uri while using POSTMAN. </p>
  
  <p>Here is the code to get the statelist:</p>
  
  <pre><code>HttpHeaders headers = new HttpHeaders();
  headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
  String baseUri = "http://www.whizapi.com/api/v2/util/ui/in/indian-states-list";
  UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUri)
                  .queryParam("project-app-key","my-key");
  HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;("parameters", headers);
  ResponseEntity&lt;String&gt; stats = restTemplate.exchange(builder.build().toUri(),
                  HttpMethod.GET,entity ,String.class);
  </code></pre>
  
  <p>Please suggest if I am missing anything.</p>