title: getting 400 null as error message for calling get method API with query parameters using rest template
body: <p>I am trying to call one get method API by passing query parameters using rest template. I am passing the request in the proper format only, but I am getting the
   error as message as "400 null". </p>
  
  <p><strong>Following is the curl command which is working properly with POSTMAN:</strong></p>
  
  <pre><code>curl -X GET \
    'http://localhost:8086/uaa/Groups?filter=identity_zone_id%20eq%20%22uaa%22' \
    -H 'authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6ImxlZ2FjeS10b2tlbi1rZXkiLCJ0eXAiOiJKV1QifQ.eyJqdGkiOiJlMmEwYzgwN2M4ZDQ0YzhiYTE1ZmUwNGJmZjFmNzNlYyIsInN1YiI6IjBkZTZlZDhkLWU1OGMtNGExNC1iNTdmLWM5Mjk2Y2JlYjM3NSIsInNjb3BlIjpbImFwaXMucmVhZCIsIm9wZW5pZCIsImFwaXMud3JpdGUiLCJ1YWEuYWRtaW4iLCJzY2ltLndyaXRlIiwic2NpbS5yZWFkIiwidWFhLnVzZXIiXSwiY2xpZW50X2lkIjoiY2xpZW50IiwiY2lkIjoiY2xpZW50IiwiYXpwIjoiY2xpZW50IiwiZ3JhbnRfdHlwZSI6ImF1dGhvcml6YXRpb25fY29kZSIsInVzZXJfaWQiOiIwZGU2ZWQ4ZC1lNThjLTRhMTQtYjU3Zi1jOTI5NmNiZWIzNzUiLCJvcmlnaW4iOiJ1YWEiLCJ1c2VyX25hbWUiOiJtYXJpc3NhIiwiZW1haWwiOiJtYXJpc3NhQHRlc3Qub3JnIiwiYXV0aF90aW1lIjoxNTEyNDU1NzU4LCJyZXZfc2lnIjoiMWE5MzYzNWYiLCJpYXQiOjE1MTI0NTU3NTksImV4cCI6MTUxMjQ5ODk1OSwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwL3VhYS9vYXV0aC90b2tlbiIsInppZCI6InVhYSIsImF1ZCI6WyJzY2ltIiwiYXBpcyIsInVhYSIsIm9wZW5pZCIsImNsaWVudCJdfQ.LbVu7inr5htyOHPyoN_KzIyFRZZiiiCV4xZHTCJZR30'
  </code></pre>
  
  <p><strong>Same format only I am passing the request through rest template. Following is the code which I am trying:</strong></p>
  
  <p>public String listGroup(String accessToken){</p>
  
  <pre><code>    String transactionUrl = "http://localhost:8086/uaa/Groups";
  </code></pre>
  
  <p>HttpHeaders headers = new HttpHeaders();</p>
  
  <pre><code>    headers.set("Authorization", "Bearer "+accessToken);
         HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(headers);
  
      UriComponentsBuilder builder = UriComponentsBuilder
          .fromUriString(transactionUrl)
          // Add query parameter
          .queryParam("filter", "identity_zone_id+eq+%22uaa%22");
  
  
      RestTemplate restTemplate = new RestTemplate();
      //String response = restTemplate.getForObject(builder.toUriString(), String.class);
      System.out.println("URL===="+builder.toUriString());
      try {
          String param= URLDecoder.decode("filter=identity_zone_id%2Beq%2B%2522uaa%2522", "UTF-8");
          System.out.println("param=="+param+"\n");
  
          String decodedURL = URLDecoder.decode(builder.toUriString(), "UTF-8");
          System.out.println("decodedURL=="+decodedURL+"\n");
          System.out.println("----------------------------------------------------");
  
          System.out.println(URLDecoder.decode(builder.toUriString(), "UTF-8"));
          System.out.println("entity=="+entity);
  
      //String decodedURL = java.net.URLDecoder.decode(builder.toUriString(), "UTF-8");
  
      ResponseEntity&lt;String&gt; response = 
              restTemplate.exchange(decodedURL, 
                                    HttpMethod.GET, entity, String.class, param);
      return "Success-"+response;
      } catch (UnsupportedEncodingException ex) {
          ex.printStackTrace();
      }
  
      return "error";
  }
  </code></pre>
  
  <p>Can anyone help me out in resolving this issue.</p>
  
  <p>Thanks &amp; Regards,</p>
  
  <p>Shilpa Kulkarni</p>