title: Spring RestTemplate: sending array / list of String in GET request
body: <p>I'm trying to send a array / list of String to my REST server through Spring RestTemplate.</p>
  
  <p>This is on my android side:</p>
  
  <pre><code>        private List&lt;String&gt; articleids = new ArrayList&lt;&gt;();
          articleids.add("563e5aeb0eab252dd4368ab7");
          articleids.add("563f2dbd9bb0152bb0ea058e");         
  
          final String url = "https://10.0.3.2:5000/getsubscribedarticles";
  
          UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url)
                  .queryParam("articleids", articleids);
          java.net.URI builtUrl = builder.build().encode().toUri();
          Log.e("builtUrl", builtUrl.toString());
  </code></pre>
  
  <p>The builtUrl is:  <a href="https://10.0.3.2:5000/getsubscribedarticles?articleids=%5B563e5aeb0eab252dd4368ab7,%20563f2dbd9bb0152bb0ea058e%5D" rel="noreferrer">https://10.0.3.2:5000/getsubscribedarticles?articleids=%5B563e5aeb0eab252dd4368ab7,%20563f2dbd9bb0152bb0ea058e%5D</a></p>
  
  <p>On the server side:</p>
  
  <pre><code> @RequestMapping(value = "/getsubscribedarticles", method = RequestMethod.GET)
  public List&lt;Posts&gt; getSubscribedPostFeed(@RequestParam("articleids") List&lt;String&gt; articleids){
       for (String articleid : articleids {
          logger.info(" articleid : " + articleid);
      }
  }
  </code></pre>
  
  <p>The server logs:</p>
  
  <blockquote>
    <p>.13:11:35.370 [http-nio-8443-exec-5] INFO  c.f.s.i.ServiceGatewayImpl
    -  articleid : [563e5aeb0eab252dd4368ab7  </p>
    
    <p>.13:11:35.370 [http-nio-8443-exec-5] INFO  c.f.s.i.ServiceGatewayImpl
    -  articleid : 563f2dbd9bb0152bb0ea058e]</p>
  </blockquote>
  
  <p>Which I can see is wrong as the list should not have a '[' on the first item and a ']' on the last item.</p>
  
  <p>I have read this thread <a href="https://stackoverflow.com/questions/22507129/how-to-pass-list-or-string-array-to-getforobject-with-spring-resttemplate">How to pass List or String array to getForObject with Spring RestTemplate</a> but it does not actually answer the question. </p>
  
  <p>The selected answer issues out a POST request, but I want to do a GET request , also it requires an additional object to work to hold the list and I would prefer to not create extra objects if I can do it with Spring RestTemplate natively.</p>